Fixed problem

This commit is contained in:
Michaela Brydon 2024-08-07 17:23:20 -04:00
parent ca97fbd658
commit f68eefcff2
3 changed files with 12 additions and 10 deletions

View file

@ -97,7 +97,7 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetName) {
* @param baseResponse * @param baseResponse
* @param clientResponse * @param clientResponse
*/ */
function processPageData(baseResponse, clientResponse) { async function processPageData(baseResponse, clientResponse) {
const pageDataFromCms = {}; const pageDataFromCms = {};
let widgets = []; let widgets = [];
@ -140,6 +140,7 @@ function processPageData(baseResponse, clientResponse) {
widgets.forEach((widget) => { widgets.forEach((widget) => {
// Global state value replacement. // Global state value replacement.
console.log(widget);
const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model, widget.Name); const widgetWithReplacements = findAndReplaceGlobalStateValues(widget.Model, widget.Name);
// If we already have this widget, push it on the collection // If we already have this widget, push it on the collection
@ -164,20 +165,20 @@ function processPageData(baseResponse, clientResponse) {
* *
* @param issPage * @param issPage
*/ */
export function fetchCmsContentForPage(issPage) { export async function fetchCmsContentForPage(issPage) {
const store = useMainStore(); const store = useMainStore();
const { clientName } = store.issConfig; const { clientName } = store.issConfig;
const { parentAccountNumber } = store.issConfig; const { parentAccountNumber } = store.issConfig;
const clientOverride = clientName.length > 0 && parentAccountNumber > 0; const clientOverride = clientName.length > 0 && parentAccountNumber > 0;
return ( return await (
store store
.getPageData(issPage) .getPageData(issPage)
// Get the base/default page first. // Get the base/default page first.
.then((baseResponse) => { .then(async (baseResponse) => {
if (!clientOverride) { if (!clientOverride) {
// Return the base page if there are no client override. // 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. // Else get the client override page.
const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`; const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`;
@ -186,10 +187,11 @@ export function fetchCmsContentForPage(issPage) {
(clientResponse) => (clientResponse) =>
// Process the client override if it exists. // Process the client override if it exists.
processPageData(baseResponse, clientResponse), processPageData(baseResponse, clientResponse),
(error) => { async (error) => {
console.error(error); console.error(error);
// Process the just the base if no client override exists. // Process the just the base if no client override exists.
return processPageData(baseResponse, null); var x = await processPageData(baseResponse, null);
return x;
} }
); );
}) })

View file

@ -105,7 +105,6 @@ import {
import { toTitleCase } from '@/helpers/text-helper.js'; import { toTitleCase } from '@/helpers/text-helper.js';
import { AppointmentTypeStrings } from '@/constants/schedule-constants'; import { AppointmentTypeStrings } from '@/constants/schedule-constants';
import applicationConfig from '@/constants/application-config'; import applicationConfig from '@/constants/application-config';
import submitType from '@/constants/submit-type';
export default { export default {
name: 'order-confirmation', name: 'order-confirmation',
@ -121,7 +120,7 @@ export default {
mixins: [BaseFormMixin], mixins: [BaseFormMixin],
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
// Call APIs // Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); const cmsContent = fetchCmsContentForPage(to.query.issPage);
// Settle promises and get results // Settle promises and get results
const promiseResultMap = [ const promiseResultMap = [

View file

@ -419,7 +419,8 @@ export const useMainStore = defineStore({
experimentSettings: (state) => state.applicationUser.experiments experimentSettings: (state) => state.applicationUser.experiments
.filter((x) => !!x.isActive) .filter((x) => !!x.isActive)
.map((x) => x.settings) .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: actions:
{ {