serviceability details
This commit is contained in:
parent
dae64e0ef4
commit
5ed736cf35
3 changed files with 24 additions and 6 deletions
|
|
@ -46,7 +46,11 @@ const endpoints = {
|
|||
GetPartFromCapabilityAnswer: {
|
||||
url: "/parts/api/v1/parts/part-from-capability-answer",
|
||||
method: "POST",
|
||||
},
|
||||
},
|
||||
GetServiceabilityDetails: {
|
||||
url: "/location/api/v1/location/serviceability-details",
|
||||
method: "GET",
|
||||
},
|
||||
GetVehicle: {
|
||||
url: "/vehicle/api/v1/vehicle/lookup",
|
||||
method: "GET",
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import { useMainStore } from '@/store';
|
|||
import baseMixin from "@/mixins/base-mixin.js";
|
||||
|
||||
export async function getServiceabilityDetails(serviceZipCode, lineItems) {
|
||||
const serviceabilityDetails = await baseMixin.methods.dispatchStoreAction(
|
||||
useMainStore.GET_SERVICEABILITY_DETAILS,
|
||||
const serviceabilityDetails = await useMainStore().getServiceabilityDetails(
|
||||
{
|
||||
serviceZipCode: serviceZipCode,
|
||||
lineItems: lineItems,
|
||||
|
|
|
|||
|
|
@ -40,15 +40,17 @@
|
|||
</template>
|
||||
<script>
|
||||
// Import Supporting Files
|
||||
import { fetchCmsContentForPage, setupModalLinks } from "@/helpers/cms-content-helper";
|
||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import { required } from "@/helpers/validation-rules";
|
||||
import { errorMessages } from "@/constants/error-messages";
|
||||
import buttonQuestion from "@/digital-components/button-question/button-question";
|
||||
import { useMainStore } from "@/store";
|
||||
import { getServiceabilityDetails } from "@/helpers/service-location-helper";
|
||||
|
||||
// Import Component
|
||||
import baseFormMixin from "@/mixins/base-form-mixin";
|
||||
import baseMixin from "@/mixins/base-mixin";
|
||||
import { Form, defineRule } from "vee-validate";
|
||||
import siteFooter from "@/iss-components/site-footer/site-footer.vue";
|
||||
import siteHeader from "@/iss-components/site-header/site-header.vue";
|
||||
|
|
@ -59,17 +61,30 @@ import serviceZipModalQuestion from '@/layouts/service-location/service-zip-moda
|
|||
defineRule("selection-required", required(errorMessages.OPTION_REQUIRED));
|
||||
export default {
|
||||
name: "service-location",
|
||||
mixins: [baseFormMixin],
|
||||
mixins: [baseFormMixin, baseMixin],
|
||||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
||||
const serviceZipCode = useMainStore().order.serviceLocation.zipCode;
|
||||
const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode);
|
||||
|
||||
const serviceabilityDetailsPromise = getServiceabilityDetails(serviceZipCode);
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: "cmsContent",
|
||||
promise: cmsContentPromise,
|
||||
},
|
||||
},
|
||||
{
|
||||
resultKey: "serviceabilityDetails",
|
||||
promise: serviceabilityDetailsPromise,
|
||||
},
|
||||
{
|
||||
resultKey: "zipCodeData",
|
||||
promise: getZipCodeData,
|
||||
},
|
||||
];
|
||||
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
|
|
|||
Loading…
Reference in a new issue