From 93f9591c8e39109ad075fdffaf29ec7d0a55ea6c Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Mon, 23 Sep 2024 14:44:18 +0530 Subject: [PATCH 1/3] Improved: Fixed popover not closing and corrected the primary store tag display issue(#304) --- src/components/ProductStorePopover.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ProductStorePopover.vue b/src/components/ProductStorePopover.vue index f4da6ba..ceef80d 100644 --- a/src/components/ProductStorePopover.vue +++ b/src/components/ProductStorePopover.vue @@ -76,7 +76,7 @@ export default defineComponent({ primaryFacilityGroupId: '' }) } - + await this.store.dispatch('facility/updateCurrentFacility', { ...this.current, primaryFacilityGroupId: '' }) // refetching product stores with updated roles await this.store.dispatch('facility/getFacilityProductStores', { facilityId: this.facilityId }) } else { @@ -119,6 +119,7 @@ export default defineComponent({ // if we does not get shopify shop id for the store then not making product store as primary if(!shopifyShopId) { showToast(translate('Failed to make product store primary due to missing Shopify shop')) + popoverController.dismiss() emitter.emit('dismissLoader') return; } From 1dfc7a937c26cb816a861c3554d8d9f2718c1259 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Thu, 7 Nov 2024 18:58:02 +0530 Subject: [PATCH 2/3] Improved: current facility was updated to primaryFacilityGroupId='' only when the updateFacility API was successful(#304) --- src/components/ProductStorePopover.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ProductStorePopover.vue b/src/components/ProductStorePopover.vue index ceef80d..85b535f 100644 --- a/src/components/ProductStorePopover.vue +++ b/src/components/ProductStorePopover.vue @@ -75,8 +75,8 @@ export default defineComponent({ facilityId: this.facilityId, primaryFacilityGroupId: '' }) + await this.store.dispatch('facility/updateCurrentFacility', { ...this.current, primaryFacilityGroupId: '' }) } - await this.store.dispatch('facility/updateCurrentFacility', { ...this.current, primaryFacilityGroupId: '' }) // refetching product stores with updated roles await this.store.dispatch('facility/getFacilityProductStores', { facilityId: this.facilityId }) } else { From 9191a81a3ddc52bfe9c60f128726fc7a27c95810 Mon Sep 17 00:00:00 2001 From: R-Sourabh Date: Wed, 20 Nov 2024 10:53:15 +0530 Subject: [PATCH 3/3] Improved: Refactored removeStoreFromFacility to add error handling for updateFacility(#304) --- src/components/ProductStorePopover.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/ProductStorePopover.vue b/src/components/ProductStorePopover.vue index 85b535f..0d372f9 100644 --- a/src/components/ProductStorePopover.vue +++ b/src/components/ProductStorePopover.vue @@ -71,11 +71,15 @@ export default defineComponent({ // TODO: need to check if we need to remove primary value from the facility if product store is removed. // Removing primaryFacilityGroupId from the facility, if present if(this.shopifyShopIdForProductStore(this.currentProductStore.productStoreId) === this.current.primaryFacilityGroupId) { - await FacilityService.updateFacility({ + const updateResp = await FacilityService.updateFacility({ facilityId: this.facilityId, primaryFacilityGroupId: '' - }) - await this.store.dispatch('facility/updateCurrentFacility', { ...this.current, primaryFacilityGroupId: '' }) + }); + if (!hasError(updateResp)) { + await this.store.dispatch('facility/updateCurrentFacility', { ...this.current, primaryFacilityGroupId: '' }); + } else { + throw updateResp.data; + } } // refetching product stores with updated roles await this.store.dispatch('facility/getFacilityProductStores', { facilityId: this.facilityId })