Skip to content

Commit

Permalink
Merge pull request #268 from amansinghbais/267-support-for-productSto…
Browse files Browse the repository at this point in the history
…re-filter

Implemented: support for redirecting user to findFacilities page along with productStoreId coming in query (#267)
  • Loading branch information
ymaheshwari1 authored May 31, 2024
2 parents de440b9 + 27a79d1 commit 8f4c64a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import logger from '@/logger'
import { getServerPermissionsFromRules, prepareAppPermissions, resetPermissions, setPermissions } from '@/authorization'
import { translate, useAuthStore, useUserStore } from '@hotwax/dxp-components'
import emitter from '@/event-bus'
import router from '@/router'

const actions: ActionTree<UserState, RootState> = {

Expand Down Expand Up @@ -61,6 +62,11 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_PERMISSIONS_UPDATED, appPermissions);
commit(types.USER_TOKEN_CHANGED, { newToken: token })
updateToken(token)

const productStoreId = router.currentRoute.value?.query?.productStoreId
if (productStoreId) {
return `/tabs/find-facilities?productStoreId=${productStoreId}`;
}
} catch (err: any) {
// If any of the API call in try block has status code other than 2xx it will be handled in common catch block.
// TODO Check if handling of specific status codes is required.
Expand Down
4 changes: 4 additions & 0 deletions src/views/FindFacilities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ export default defineComponent({
// from the details page and again coming to the list page, the UI does not gets updated when fetching information in
// the mounted hook
this.isScrollingEnabled = false;
if(this.router.currentRoute.value?.query?.productStoreId) {
this.query.productStoreId = this.router.currentRoute.value.query.productStoreId
await this.store.dispatch('facility/updateFacilityQuery', this.query)
}
await this.fetchFacilities();
},
methods: {
Expand Down

0 comments on commit 8f4c64a

Please sign in to comment.