update getZipCodeData to return object

This commit is contained in:
Bill Richardson 2024-06-10 15:10:47 -04:00
parent 2c93b357a1
commit 4266a231a2

View file

@ -1,15 +1,17 @@
import { useMainStore } from '@/store';
export async function getZipCodeData(zipCode) {
const serviceZipValidationResponse = await useMainStore().validateZip({ zip: zipCode });
return {
containsMilitaryBase: serviceZipValidationResponse.containsMilitaryBase,
isValid: serviceZipValidationResponse.isValid,
isServiceable: serviceZipValidationResponse.isServiceable,
state: serviceZipValidationResponse.state,
zipCodeCtu: serviceZipValidationResponse.zipCodeCtu
};
return await useMainStore().validateZip({ zip: zipCode })
.then((serviceZipValidationResponse) => ({
containsMilitaryBase: serviceZipValidationResponse.containsMilitaryBase,
isValid: serviceZipValidationResponse.isValid,
isServiceable: serviceZipValidationResponse.isServiceable,
state: serviceZipValidationResponse.state,
zipCodeCtu: serviceZipValidationResponse.zipCodeCtu
}))
.catch(() => ({
isValid: false
}));
}
export async function getPricedMobileFeePart(serviceZipCode) {
@ -20,7 +22,6 @@ export async function getPricedMobileFeePart(serviceZipCode) {
// Get the Mobile Fee Part
const mobileFeePart = await useMainStore().getMobileFeePart();
if (mobileFeePart.data == null || mobileFeePart.data === '') {
return Promise.resolve(null);
}