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
|
||||
);
|
||||
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 buttonQuestion from "@/digital-components/button-question/button-question";
|
||||
import { useMainStore } from "@/store";
|
||||
import { getServiceabilityDetails } from "@/helpers/service-location-helper";
|
||||
import { getServiceabilityDetails, getZipCodeData } from "@/helpers/service-location-helper";
|
||||
|
||||
// Import Component
|
||||
import baseFormMixin from "@/mixins/base-form-mixin";
|
||||
|
|
@ -76,7 +76,7 @@ export default {
|
|||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
||||
const serviceZipCode = useMainStore().order.customer.address.zipCode;
|
||||
const getZipCodeData = baseMixin.methods.getZipCodeData(serviceZipCode);
|
||||
const zipCodeData = getZipCodeData(serviceZipCode);
|
||||
|
||||
const serviceabilityDetailsPromise = getServiceabilityDetails(serviceZipCode);
|
||||
|
||||
|
|
@ -92,7 +92,7 @@ export default {
|
|||
},
|
||||
{
|
||||
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 alert from "@/ux-components/alert/alert";
|
||||
|
||||
import { getServiceabilityDetails } from "@/helpers/service-location-helper";
|
||||
import { getServiceabilityDetails, getZipCodeData } from "@/helpers/service-location-helper";
|
||||
|
||||
export default {
|
||||
name: "service-zip-modal-question",
|
||||
|
|
@ -94,7 +94,7 @@ export default {
|
|||
focusOnZipInput() {
|
||||
const input = document.getElementById(this.serviceZipCodeTextInputId);
|
||||
input?.focus();
|
||||
; },
|
||||
},
|
||||
copyModel(modelToCopy) {
|
||||
return {
|
||||
state: modelToCopy.state,
|
||||
|
|
@ -150,6 +150,7 @@ export default {
|
|||
this.closeModal();
|
||||
}
|
||||
},
|
||||
getZipCodeData,
|
||||
},
|
||||
watch: {
|
||||
modelValue(newValue) {
|
||||
|
|
|
|||
|
|
@ -27,19 +27,6 @@ export default {
|
|||
savePageDataToStore(page, 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: {
|
||||
// store will be accessible globally as its id + 'Store'
|
||||
|
|
|
|||
Loading…
Reference in a new issue