move getZipCodeData() from base-mixin to service-location-helper
This commit is contained in:
parent
6aaacdef8c
commit
2a73020aad
4 changed files with 20 additions and 18 deletions
|
|
@ -9,4 +9,18 @@ export async function getServiceabilityDetails(serviceZipCode, lineItems) {
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
return Promise.resolve(serviceabilityDetails);
|
return Promise.resolve(serviceabilityDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getZipCodeData(zipCode) {
|
||||||
|
const serviceZipValidationResponse = await useMainStore().validateZip(
|
||||||
|
{ zip: zipCode }
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
containsMilitaryBase: serviceZipValidationResponse.data.containsMilitaryBase,
|
||||||
|
isValid: serviceZipValidationResponse.data.isValid,
|
||||||
|
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
||||||
|
state: serviceZipValidationResponse.data.state,
|
||||||
|
zipCodeCtu: serviceZipValidationResponse.data.zipCodeCtu,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@ import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import buttonQuestion from "@/digital-components/button-question/button-question";
|
import buttonQuestion from "@/digital-components/button-question/button-question";
|
||||||
import { useMainStore } from "@/store";
|
import { useMainStore } from "@/store";
|
||||||
import { getServiceabilityDetails } from "@/helpers/service-location-helper";
|
import { getServiceabilityDetails, getZipCodeData } from "@/helpers/service-location-helper";
|
||||||
|
|
||||||
// Import Component
|
// Import Component
|
||||||
import baseFormMixin from "@/mixins/base-form-mixin";
|
import baseFormMixin from "@/mixins/base-form-mixin";
|
||||||
|
|
@ -76,7 +76,7 @@ export default {
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||||
|
|
||||||
const serviceZipCode = useMainStore().order.customer.address.zipCode;
|
const serviceZipCode = useMainStore().order.customer.address.zipCode;
|
||||||
const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode);
|
const zipCodeData = getZipCodeData(serviceZipCode);
|
||||||
|
|
||||||
const serviceabilityDetailsPromise = getServiceabilityDetails(serviceZipCode);
|
const serviceabilityDetailsPromise = getServiceabilityDetails(serviceZipCode);
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
resultKey: "zipCodeData",
|
resultKey: "zipCodeData",
|
||||||
promise: getZipCodeData,
|
promise: zipCodeData,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-que
|
||||||
import modal from "@/digital-components/modal/modal.vue"
|
import modal from "@/digital-components/modal/modal.vue"
|
||||||
import alert from "@/ux-components/alert/alert";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
|
||||||
import { getServiceabilityDetails } from "@/helpers/service-location-helper";
|
import { getServiceabilityDetails, getZipCodeData } from "@/helpers/service-location-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "service-zip-modal-question",
|
name: "service-zip-modal-question",
|
||||||
|
|
@ -94,7 +94,7 @@ export default {
|
||||||
focusOnZipInput() {
|
focusOnZipInput() {
|
||||||
const input = document.getElementById(this.serviceZipCodeTextInputId);
|
const input = document.getElementById(this.serviceZipCodeTextInputId);
|
||||||
input?.focus();
|
input?.focus();
|
||||||
; },
|
},
|
||||||
copyModel(modelToCopy) {
|
copyModel(modelToCopy) {
|
||||||
return {
|
return {
|
||||||
state: modelToCopy.state,
|
state: modelToCopy.state,
|
||||||
|
|
@ -150,6 +150,7 @@ export default {
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getZipCodeData,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
modelValue(newValue) {
|
modelValue(newValue) {
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,6 @@ export default {
|
||||||
savePageDataToStore(page, data) {
|
savePageDataToStore(page, data) {
|
||||||
useMainStore().updatePageData({ page: page, data: data});
|
useMainStore().updatePageData({ page: page, data: data});
|
||||||
},
|
},
|
||||||
async getZipCodeData(zipCode) {
|
|
||||||
const serviceZipValidationResponse = await useMainStore().validateZip(
|
|
||||||
{ zip: zipCode }
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
containsMilitaryBase: serviceZipValidationResponse.data.containsMilitaryBase,
|
|
||||||
isValid: serviceZipValidationResponse.data.isValid,
|
|
||||||
isServiceable: serviceZipValidationResponse.data.isServiceable,
|
|
||||||
state: serviceZipValidationResponse.data.state,
|
|
||||||
zipCodeCtu: serviceZipValidationResponse.data.zipCodeCtu,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// store will be accessible globally as its id + 'Store'
|
// store will be accessible globally as its id + 'Store'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue