Skip to content

Commit

Permalink
Improved: code to clear the util and facility state on logout(#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymaheshwari1 committed Nov 15, 2023
1 parent cac084b commit 71ae01b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/store/modules/facility/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const actions: ActionTree<FacilityState, RootState> = {
throw resp.data
}
} catch(error) {
console.error(error)
logger.error(error)
}

emitter.emit("dismissLoader");
Expand All @@ -79,6 +79,15 @@ const actions: ActionTree<FacilityState, RootState> = {

updateQuery({ commit }, query) {
commit(types.FACILITY_QUERY_UPDATED, query)
},

clearFacilites({ commit }) {
commit(types.FACILITY_QUERY_UPDATED, {
queryString: '',
productStoreId: '',
facilityTypeId: ''
})
commit(types.FACILITY_LIST_UPDATED , { facilities: [], total: 0 });
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ const actions: ActionTree<UserState, RootState> = {
resetConfig();
resetPermissions();

this.dispatch('util/clearUtilState')
this.dispatch('facility/clearFacilityState')

// reset plugin state on logout
authStore.$reset()
userStore.$reset()
Expand Down

0 comments on commit 71ae01b

Please sign in to comment.