CSR-1384: use deepClone on resultMap and glassParts
This commit is contained in:
parent
5a3d9c3b80
commit
ab1f47d038
1 changed files with 21 additions and 17 deletions
|
|
@ -105,6 +105,7 @@ import alert from "@/ux-components/alert/alert";
|
||||||
|
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
import { deepClone } from "@/helpers/object-helper";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
|
|
@ -120,6 +121,7 @@ export default {
|
||||||
null,
|
null,
|
||||||
"payment-method"
|
"payment-method"
|
||||||
);
|
);
|
||||||
|
|
||||||
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_RAIN_DEFENSE,
|
storeActions.GET_RAIN_DEFENSE,
|
||||||
null,
|
null,
|
||||||
|
|
@ -151,28 +153,30 @@ export default {
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
const clonedGlassParts = store.getters.order.lineItems.glassParts
|
|
||||||
? JSON.parse(JSON.stringify(store.getters.order.lineItems.glassParts))
|
const resultMapCopy = deepClone(resultMap) ?? [];
|
||||||
: [];
|
|
||||||
|
const glassPartsCopy = deepClone(store.getters.order.lineItems.glassParts) ?? [];
|
||||||
|
|
||||||
const availableLineItems = [
|
const availableLineItems = [
|
||||||
resultMap.rainDefense,
|
resultMapCopy.rainDefense,
|
||||||
...resultMap.supportingItems,
|
...resultMapCopy.supportingItems,
|
||||||
...resultMap.wipers,
|
...resultMapCopy.wipers,
|
||||||
...clonedGlassParts,
|
...glassPartsCopy,
|
||||||
];
|
];
|
||||||
|
|
||||||
// TODO - DO WE NEED TO GET PRICINGRESULTS HERE? SEEMS TO BE THE SAME AS availableLineItems
|
// TODO - DO WE NEED TO GET PRICINGRESULTS HERE? SEEMS TO BE THE SAME AS availableLineItems
|
||||||
const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
// const pricingResults = await baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
// storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA,
|
||||||
{
|
// {
|
||||||
availableLineItems: availableLineItems,
|
// availableLineItems: availableLineItems,
|
||||||
},
|
// },
|
||||||
"payment-method",
|
// "payment-method",
|
||||||
false
|
// false
|
||||||
);
|
// );
|
||||||
const lineItems = store.getters.lineItems;
|
const lineItems = store.getters.lineItems;
|
||||||
|
|
||||||
const cartItems = [...clonedGlassParts, ...lineItems.supportingItems, ...lineItems.vaps];
|
const cartItems = [...glassPartsCopy, ...lineItems.supportingItems, ...lineItems.vaps];
|
||||||
|
|
||||||
// Call the "next" function to complete the transition to this page.
|
// Call the "next" function to complete the transition to this page.
|
||||||
next((vm) => {
|
next((vm) => {
|
||||||
|
|
@ -181,7 +185,7 @@ export default {
|
||||||
vm.cartItems = cartItems; // TOBEREMOVED BY AJC IN CSR-1384
|
vm.cartItems = cartItems; // TOBEREMOVED BY AJC IN CSR-1384
|
||||||
|
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.availableLineItems = pricingResults;
|
vm.availableLineItems = availableLineItems;
|
||||||
vm.lineItems = lineItems;
|
vm.lineItems = lineItems;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue