Merge pull request #560 from Safelite/feature/SSR-1105
Feature/ssr 1105
This commit is contained in:
commit
1d9b7f88f8
3 changed files with 29 additions and 7 deletions
|
|
@ -99,6 +99,10 @@ const endpoints = Object.freeze({
|
|||
url: '/vehicle/api/v1/vehicle/lookup',
|
||||
method: 'GET'
|
||||
},
|
||||
GetAccountInfo: {
|
||||
url: '/account/api/v1/account/',
|
||||
method: 'GET'
|
||||
},
|
||||
LogExperimentExposureIfAssigned: {
|
||||
url: '/experiments/api/v1/experiments/log-exposure',
|
||||
method: 'POST'
|
||||
|
|
|
|||
|
|
@ -99,13 +99,19 @@ export default {
|
|||
async beforeRouteEnter(to, from, next) {
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
const accountInfoPromise = useMainStore().getCarrierAccountInfo();
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: 'cmsContent',
|
||||
promise: cmsContentPromise
|
||||
}];
|
||||
// use resultMap to populate layout content.
|
||||
},
|
||||
{
|
||||
resultKey: 'accountInfo',
|
||||
promise: accountInfoPromise
|
||||
}
|
||||
];
|
||||
// use resultMap to populate layout content.
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
|
|
@ -161,15 +167,14 @@ export default {
|
|||
isVerified() {
|
||||
return useMainStore().order.payment.insuranceCoverage.isVerified;
|
||||
},
|
||||
// TODO: Replace with actual carrier number when account service is ready
|
||||
carrierPhoneNumber() {
|
||||
return '800-000-0000';
|
||||
},
|
||||
carrierName() {
|
||||
return this.mainStore.issConfig.clientName;
|
||||
},
|
||||
carrierUrl() {
|
||||
return this.mainStore.issConfig.successReturnURL;
|
||||
},
|
||||
carrierPhoneNumber() {
|
||||
return this.toDisplayPhoneNumber(useMainStore().order.carrierPhoneNumber);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,8 @@ const getDefaultState = () => ({
|
|||
eon: null,
|
||||
workOrderNumber: null,
|
||||
originalDeductible: null,
|
||||
currentDeductible: null
|
||||
currentDeductible: null,
|
||||
carrierPhoneNumber: null
|
||||
},
|
||||
applicationUser: {
|
||||
experiments: [],
|
||||
|
|
@ -925,6 +926,18 @@ export const useMainStore = defineStore({
|
|||
});
|
||||
},
|
||||
|
||||
getCarrierAccountInfo() {
|
||||
return new Promise((resolve, reject) => {
|
||||
globalMethods.callHttpClient({
|
||||
method: endpoints.GetAccountInfo.method,
|
||||
endpoint: endpoints.GetAccountInfo.url + this.issConfig.parentAccountNumber
|
||||
}).then((response) => {
|
||||
this.order.carrierPhoneNumber = response.data.phoneNumber;
|
||||
return resolve(response.data);
|
||||
}).catch((error) => reject(error));
|
||||
});
|
||||
},
|
||||
|
||||
async getSupportingItems() {
|
||||
const glassPartsArray = this.order.lineItems.glassParts ?? [];
|
||||
const { carId } = this.order.vehicle;
|
||||
|
|
|
|||
Loading…
Reference in a new issue