From 82acf5c54310ebb5d8eca9c85b6e229d213efa6b Mon Sep 17 00:00:00 2001 From: Yash Maheshwari <yash.maheshwari@hotwax.co> Date: Mon, 18 Mar 2024 14:35:15 +0530 Subject: [PATCH 1/2] Fixed: issue when redirecting to commerce after successfull upload of inventory or PO file(#268) --- src/views/InventoryReview.vue | 3 ++- src/views/PurchaseOrderReview.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/InventoryReview.vue b/src/views/InventoryReview.vue index 9274420b..41e75281 100644 --- a/src/views/InventoryReview.vue +++ b/src/views/InventoryReview.vue @@ -258,7 +258,8 @@ export default defineComponent({ text: translate('View'), role: 'view', handler: () => { - window.open(`https://${this.instanceUrl}.hotwax.io/commerce/control/ImportData?configId=RESET_INVENTORY`, '_blank'); + const omsURL = (this.instanceUrl.startsWith('http') ? this.instanceUrl.replace(/api\/?/, "") : `https://${this.instanceUrl}.hotwax.io`) + `/commerce/control/ImportData?configId=RESET_INVENTORY` + window.open(omsURL, '_blank'); } }]) this.router.push("/inventory"); diff --git a/src/views/PurchaseOrderReview.vue b/src/views/PurchaseOrderReview.vue index fee6e4aa..394f4a6a 100644 --- a/src/views/PurchaseOrderReview.vue +++ b/src/views/PurchaseOrderReview.vue @@ -283,7 +283,8 @@ export default defineComponent({ text: translate('View'), role: 'view', handler: () => { - window.open(`https://${this.instanceUrl}.hotwax.io/commerce/control/ImportData?configId=IMP_PO`, '_blank'); + const omsURL = (this.instanceUrl.startsWith('http') ? this.instanceUrl.replace(/api\/?/, "") : `https://${this.instanceUrl}.hotwax.io`) + `/commerce/control/ImportData?configId=IMP_PO` + window.open(omsURL, '_blank'); } }]) this.router.push("/purchase-order"); From ce2d6c96b5afca65aa552920f5161b69e84d7f87 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari <yash.maheshwari@hotwax.co> Date: Mon, 18 Mar 2024 15:36:54 +0530 Subject: [PATCH 2/2] Improved: regex to remove duplicate / in some cases(#268) --- src/views/InventoryReview.vue | 2 +- src/views/PurchaseOrderReview.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/InventoryReview.vue b/src/views/InventoryReview.vue index 41e75281..f411e8d3 100644 --- a/src/views/InventoryReview.vue +++ b/src/views/InventoryReview.vue @@ -258,7 +258,7 @@ export default defineComponent({ text: translate('View'), role: 'view', handler: () => { - const omsURL = (this.instanceUrl.startsWith('http') ? this.instanceUrl.replace(/api\/?/, "") : `https://${this.instanceUrl}.hotwax.io`) + `/commerce/control/ImportData?configId=RESET_INVENTORY` + const omsURL = (this.instanceUrl.startsWith('http') ? this.instanceUrl.replace(/\/api\/?|\/$/, "") : `https://${this.instanceUrl}.hotwax.io`) + `/commerce/control/ImportData?configId=RESET_INVENTORY` window.open(omsURL, '_blank'); } }]) diff --git a/src/views/PurchaseOrderReview.vue b/src/views/PurchaseOrderReview.vue index 394f4a6a..cfb789c8 100644 --- a/src/views/PurchaseOrderReview.vue +++ b/src/views/PurchaseOrderReview.vue @@ -283,7 +283,7 @@ export default defineComponent({ text: translate('View'), role: 'view', handler: () => { - const omsURL = (this.instanceUrl.startsWith('http') ? this.instanceUrl.replace(/api\/?/, "") : `https://${this.instanceUrl}.hotwax.io`) + `/commerce/control/ImportData?configId=IMP_PO` + const omsURL = (this.instanceUrl.startsWith('http') ? this.instanceUrl.replace(/\/api\/?|\/$/, "") : `https://${this.instanceUrl}.hotwax.io`) + `/commerce/control/ImportData?configId=IMP_PO` window.open(omsURL, '_blank'); } }])