Skip to content

Commit

Permalink
Merge pull request #36 from amansinghbais/page-size-fetching
Browse files Browse the repository at this point in the history
Improved: pageSize filter while fetching records for avoiding missing records issue
  • Loading branch information
ravilodhi authored Oct 4, 2024
2 parents 3114a47 + 37381e0 commit 74be0ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/services/ProductStoreService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@ const fetchProductStoreDetails = async (productStoreId: any): Promise <any> => {
});
}

const fetchProductStores = async (): Promise <any> => {
const fetchProductStores = async (payload: any): Promise <any> => {
return api({
url: "productStores",
method: "get"
method: "get",
params: payload
});
}

const fetchProductStoresFacilityCount = async (): Promise <any> => {
const fetchProductStoresFacilityCount = async (payload: any): Promise <any> => {
return api({
url: "productStores/facilities/counts",
method: "get"
method: "get",
params: payload
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/store/modules/productStore/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const actions: ActionTree<ProductStoreState, RootState> = {
let productStores = [];

try {
const resp = await ProductStoreService.fetchProductStores();
const resp = await ProductStoreService.fetchProductStores({ pageSize: 100 });

if(!hasError(resp)) {
productStores = resp.data;
Expand Down Expand Up @@ -52,7 +52,7 @@ const actions: ActionTree<ProductStoreState, RootState> = {
const productStoresFacilityCount = {} as any;

try {
const resp = await ProductStoreService.fetchProductStoresFacilityCount();
const resp = await ProductStoreService.fetchProductStoresFacilityCount({ pageSize: 100 });

if(!hasError(resp)) {
resp.data.map((response: any) => productStoresFacilityCount[response.productStoreId] = response.facilityCount)
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/util/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const actions: ActionTree<UtilState, RootState> = {
let productIdentifiers = [] as any;

try {
const resp = await UtilService.fetchEnums({ enumTypeId: "SHOP_PROD_IDENTITY" })
const resp = await UtilService.fetchEnums({ enumTypeId: "SHOP_PROD_IDENTITY", pageSize: 100 })
if(!hasError(resp)) {
productIdentifiers = resp.data;
} else {
Expand Down

0 comments on commit 74be0ee

Please sign in to comment.