CSR-1411: update store Get Wipers method to accept a Zip and CarId; update usages
This commit is contained in:
parent
78d8468414
commit
14be2c2409
6 changed files with 46 additions and 8 deletions
|
|
@ -89,22 +89,46 @@ export default {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
||||||
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
storeActions.GET_WIPERS,
|
||||||
|
{
|
||||||
|
serviceZipCode: store.getters.submittedOrder.serviceLocation.zipCode,
|
||||||
|
carId: store.getters.submittedOrder.vehicle.carId,
|
||||||
|
},
|
||||||
|
"confirmation"
|
||||||
|
);
|
||||||
|
|
||||||
|
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
storeActions.GET_RAIN_DEFENSE,
|
||||||
|
null,
|
||||||
|
"confirmation"
|
||||||
|
);
|
||||||
|
|
||||||
// Settle promises and get results
|
// Settle promises and get results
|
||||||
const promiseResultMap = [
|
const promiseResultMap = [
|
||||||
{
|
{
|
||||||
resultKey: "cmsContent",
|
resultKey: "cmsContent",
|
||||||
promise: cmsContentPromise,
|
promise: cmsContentPromise,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
resultKey: "wipers",
|
||||||
|
promise: wipersPromise,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
resultKey: "rainDefense",
|
||||||
|
promise: rainDefensePromise,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const resultMap = await settleAllPromises(promiseResultMap);
|
const resultMap = await settleAllPromises(promiseResultMap);
|
||||||
|
const availableVaps = [resultMap.rainDefense, ...resultMap.wipers];
|
||||||
const lineItemsFromSubmittedOrder = deepClone(store.getters.submittedOrder.lineItems);
|
const lineItemsFromSubmittedOrder = deepClone(store.getters.submittedOrder.lineItems);
|
||||||
|
|
||||||
// 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) => {
|
||||||
vm.setCmsContent(resultMap.cmsContent);
|
vm.setCmsContent(resultMap.cmsContent);
|
||||||
vm.lineItems = lineItemsFromSubmittedOrder;
|
vm.lineItems = lineItemsFromSubmittedOrder;
|
||||||
vm.vaps = lineItemsFromSubmittedOrder.vaps;
|
vm.vaps = availableVaps;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,10 @@ export default {
|
||||||
|
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
null,
|
{
|
||||||
|
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
||||||
|
carId: store.getters.vehicle.carId,
|
||||||
|
},
|
||||||
"payment-method"
|
"payment-method"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,10 @@ export default {
|
||||||
|
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
null,
|
{
|
||||||
|
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
||||||
|
carId: store.getters.vehicle.carId,
|
||||||
|
},
|
||||||
"payment"
|
"payment"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,10 @@ export default {
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
null,
|
{
|
||||||
|
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
||||||
|
carId: store.getters.vehicle.carId,
|
||||||
|
},
|
||||||
"quote"
|
"quote"
|
||||||
);
|
);
|
||||||
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import {
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
|
import store from "@/store";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-package-review",
|
name: "service-package-review",
|
||||||
|
|
@ -34,7 +35,10 @@ export default {
|
||||||
loadInitialData() {
|
loadInitialData() {
|
||||||
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const wipersPromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.GET_WIPERS,
|
storeActions.GET_WIPERS,
|
||||||
null,
|
{
|
||||||
|
serviceZipCode: store.getters.order.serviceLocation.zipCode,
|
||||||
|
carId: store.getters.vehicle.carId,
|
||||||
|
},
|
||||||
"review"
|
"review"
|
||||||
);
|
);
|
||||||
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
const rainDefensePromise = baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
|
|
|
||||||
|
|
@ -1301,9 +1301,10 @@ export const actions = {
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getWipers(context, { pageNameToLog }) {
|
async getWipers(context, { payload, pageNameToLog }) {
|
||||||
const carId = context.getters.vehicle.carId;
|
const carId = payload.carId;
|
||||||
const serviceZipCode = context.getters.order.serviceLocation.zipCode;
|
const serviceZipCode = payload.serviceZipCode;
|
||||||
|
|
||||||
const response = await globalMethods
|
const response = await globalMethods
|
||||||
.callHttpClient({
|
.callHttpClient({
|
||||||
method: endpoints.GetWipers.method,
|
method: endpoints.GetWipers.method,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue