diff --git a/src/helpers/cms-content-helper.js b/src/helpers/cms-content-helper.js index 4b44e722..455aee81 100644 --- a/src/helpers/cms-content-helper.js +++ b/src/helpers/cms-content-helper.js @@ -97,7 +97,7 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetName) { * @param baseResponse * @param clientResponse */ -function processPageData(baseResponse, clientResponse) { +async function processPageData(baseResponse, clientResponse) { const pageDataFromCms = {}; let widgets = []; @@ -140,6 +140,7 @@ function processPageData(baseResponse, clientResponse) { widgets.forEach((widget) => { // Global state value replacement. + console.log(widget); const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model, widget.Name); // If we already have this widget, push it on the collection @@ -164,20 +165,20 @@ function processPageData(baseResponse, clientResponse) { * * @param issPage */ -export function fetchCmsContentForPage(issPage) { +export async function fetchCmsContentForPage(issPage) { const store = useMainStore(); const { clientName } = store.issConfig; const { parentAccountNumber } = store.issConfig; const clientOverride = clientName.length > 0 && parentAccountNumber > 0; - return ( + return await ( store .getPageData(issPage) // Get the base/default page first. - .then((baseResponse) => { + .then(async (baseResponse) => { if (!clientOverride) { // Return the base page if there are no client override. - return processPageData(baseResponse, null); + return await processPageData(baseResponse, null); } // Else get the client override page. const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`; @@ -186,10 +187,11 @@ export function fetchCmsContentForPage(issPage) { (clientResponse) => // Process the client override if it exists. processPageData(baseResponse, clientResponse), - (error) => { + async (error) => { console.error(error); // Process the just the base if no client override exists. - return processPageData(baseResponse, null); + var x = await processPageData(baseResponse, null); + return x; } ); }) diff --git a/src/layouts/order-confirmation/order-confirmation.vue b/src/layouts/order-confirmation/order-confirmation.vue index 22e1cf6a..9fb9279f 100644 --- a/src/layouts/order-confirmation/order-confirmation.vue +++ b/src/layouts/order-confirmation/order-confirmation.vue @@ -105,7 +105,6 @@ import { import { toTitleCase } from '@/helpers/text-helper.js'; import { AppointmentTypeStrings } from '@/constants/schedule-constants'; import applicationConfig from '@/constants/application-config'; -import submitType from '@/constants/submit-type'; export default { name: 'order-confirmation', @@ -121,7 +120,7 @@ export default { mixins: [BaseFormMixin], async beforeRouteEnter(to, from, next) { // Call APIs - const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); + const cmsContent = fetchCmsContentForPage(to.query.issPage); // Settle promises and get results const promiseResultMap = [ diff --git a/src/store/index.js b/src/store/index.js index f5523394..b1284ab1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -419,7 +419,8 @@ export const useMainStore = defineStore({ experimentSettings: (state) => state.applicationUser.experiments .filter((x) => !!x.isActive) .map((x) => x.settings) - .reduce((r, c) => Object.assign(r, c), {}) ?? {} + .reduce((r, c) => Object.assign(r, c), {}) ?? {}, + submittedOrder: () => JSON.parse(window.sessionStorage.getItem(webStorageConstants.SUBMITTED_ORDER)) }, actions: {