Skip to content

Commit ac3fa71

Browse files
fixed pagination issues:key instead of pagination:pagination[key]/extracts data array under the data in pagination api call
1 parent d507391 commit ac3fa71

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/features/product/productAPI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function fetchProductsByFilters(filter, sort, pagination) {
4242
}
4343
console.log(pagination);
4444
for (let key in pagination) {
45-
queryString += `${pagination}=${pagination[key]}&`; //_page:3
45+
queryString += `${key}=${pagination[key]}&`; //_page:3
4646
}
4747
return new Promise(async (resolve) => {
4848
// TODO: we will not hard coded server url here...

src/features/product/productSlice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const fetchProductsByFiltersAsync = createAsyncThunk(
2020
const response = await fetchProductsByFilters(filter, sort, pagination);
2121

2222
// The value we return becomes the `fulfilled` action payload
23-
return response.data;
23+
return response.data.data; //pagination array comes from data array!!!!!
2424
}
2525
);
2626

0 commit comments

Comments
 (0)