Skip to content

Commit

Permalink
Fixed: catalog products should be reset on logout (#85zt0m4qc)
Browse files Browse the repository at this point in the history
  • Loading branch information
adityasharma7 committed Jun 22, 2023
1 parent 3752c68 commit 7a427e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/store/modules/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ const actions: ActionTree<ProductState, RootState> = {
try {
resp = await ProductService.getCatalogProducts(payload)

if (!hasError(resp) && resp.data.response.numFound) {
if (!hasError(resp)) {
items = resp.data.response.docs
if (payload.json.params.start > 0) items = state.catalogProducts.items.concat(items);
} else {
throw resp.data;
}
} catch (error) {
console.error(error)
Expand Down Expand Up @@ -261,5 +263,14 @@ const actions: ActionTree<ProductState, RootState> = {
emitter.emit("dismissLoader");
return product
},
/**
* Reset Catalog Products
*/
resetCatalogProducts ( { commit }) {
commit(types.PRODUCT_CATALOG_UPDATED, {
items: [],
total: 0
});
},
}
export default actions;
1 change: 1 addition & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_END_SESSION)
resetConfig();
this.dispatch("product/resetProductList")
this.dispatch("product/resetCatalogProducts")
this.dispatch("order/resetOrderQuery")
this.dispatch("job/clearCtgryAndBrkrngJobs")
this.dispatch("util/clearInvConfigs")
Expand Down

0 comments on commit 7a427e1

Please sign in to comment.