Skip to content

Commit

Permalink
done: #124 - publisher search api service
Browse files Browse the repository at this point in the history
  • Loading branch information
rkshaon committed Nov 28, 2024
1 parent 5af162c commit eefa9c4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
3 changes: 0 additions & 3 deletions backend/BookShelf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@
'DEFAULT_PAGINATION_CLASS': 'BookShelf.utilities.pagination.Pagination',
'PAGE_SIZE': 10,
'DEFAULT_FILTER_BACKENDS': 'BookShelf.utilities.filters.SearchFilter',
# 'DEFAULT_FILTER_BACKENDS': [
# 'rest_framework.filters.SearchFilter',
# ],
}

SIMPLE_JWT = {
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/services/v1/publisherAPIService.js
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;
}
};

0 comments on commit eefa9c4

Please sign in to comment.