-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
done: #124 - publisher search api service
- Loading branch information
Showing
2 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// src/services/v1/publisherAPIService.js | ||
|
||
import api from "@/services/axiosInstance"; | ||
|
||
const API_BASE_URL = process.env.VUE_APP_BACKEND_URL; | ||
const content = "publisher"; | ||
const version = "v1"; | ||
|
||
export const searchV1Publishers = async ( | ||
query = "", | ||
page = 1, | ||
pageSize = 8 | ||
) => { | ||
page = page ?? 1; | ||
pageSize = pageSize ?? 10; | ||
|
||
const URL = `${API_BASE_URL}/${content}/${version}/?search=${encodeURIComponent( | ||
query | ||
)}`; | ||
|
||
console.log("Search Publisher API:", URL); | ||
|
||
try { | ||
const response = await api.get(URL); | ||
return response.data; | ||
} catch (error) { | ||
console.error("Error searching publishers:", error); | ||
throw error; | ||
} | ||
}; |