diff --git a/src/store/index.js b/src/store/index.js index 72709239..dcb0dfcf 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -53,6 +53,7 @@ const getDefaultState = () => damageState: null, damageCity: null, isDamageGlassOnly: null, + policyLookupSuccessful: null, noCoverage: null, deductible: { repair: null, // numerical value; how much customer owes on deductible in repair case @@ -349,6 +350,7 @@ export const useMainStore = defineStore({ getCoveragePolicyInfo({ accountNumber, policyNumber, dateOfLoss, zipCode }) { // TODO: replace place holder correlationId with the real thing const placeHolderCorrelationId = '00000000-0000-0000-0000-000000000000'; + const { policy } = this.order; try { const response = globalMethods.callHttpClient({ method: endpoints.CoveragePolicyInfo.method, @@ -360,9 +362,14 @@ export const useMainStore = defineStore({ zipCode, correlationId: placeHolderCorrelationId } + }).then((r) => { + const responsePolicy = response.policies?.[0]; + policy.policyLookupSuccessful = !!responsePolicy; + return r; }); return response; } catch (responseError) { + policy.policyLookupSuccessful = false; return { error: { status: responseError.status