added filter to category page
This commit is contained in:
@@ -11,7 +11,6 @@ export const brandsApi = baseApi.injectEndpoints({
|
||||
if (params.page) {
|
||||
queryParams.append("page", params.page);
|
||||
}
|
||||
|
||||
if (params.limit) {
|
||||
queryParams.append("limit", params.limit);
|
||||
}
|
||||
@@ -29,12 +28,10 @@ export const brandsApi = baseApi.injectEndpoints({
|
||||
|
||||
getBrandProducts: builder.query({
|
||||
query: (params) => {
|
||||
// Handle both string ID and object with pagination params
|
||||
if (typeof params === 'string' || typeof params === 'number') {
|
||||
return `/brands/${params}/products`;
|
||||
}
|
||||
|
||||
// Handle object with pagination
|
||||
const { id, page = 1, limit } = params;
|
||||
let url = `/brands/${id}/products?page=${page}`;
|
||||
|
||||
@@ -44,9 +41,10 @@ export const brandsApi = baseApi.injectEndpoints({
|
||||
|
||||
return url;
|
||||
},
|
||||
transformResponse: (response) => {
|
||||
return response.data || response;
|
||||
},
|
||||
transformResponse: (response) => ({
|
||||
data: response.data || response,
|
||||
pagination: response.pagination || {},
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user