Removing unnecessary await stuff
This commit is contained in:
parent
f68eefcff2
commit
037fedaadc
1 changed files with 7 additions and 8 deletions
|
|
@ -97,7 +97,7 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetName) {
|
|||
* @param baseResponse
|
||||
* @param clientResponse
|
||||
*/
|
||||
async function processPageData(baseResponse, clientResponse) {
|
||||
function processPageData(baseResponse, clientResponse) {
|
||||
const pageDataFromCms = {};
|
||||
let widgets = [];
|
||||
|
||||
|
|
@ -165,20 +165,20 @@ async function processPageData(baseResponse, clientResponse) {
|
|||
*
|
||||
* @param issPage
|
||||
*/
|
||||
export async function fetchCmsContentForPage(issPage) {
|
||||
export function fetchCmsContentForPage(issPage) {
|
||||
const store = useMainStore();
|
||||
const { clientName } = store.issConfig;
|
||||
const { parentAccountNumber } = store.issConfig;
|
||||
const clientOverride = clientName.length > 0 && parentAccountNumber > 0;
|
||||
|
||||
return await (
|
||||
return (
|
||||
store
|
||||
.getPageData(issPage)
|
||||
// Get the base/default page first.
|
||||
.then(async (baseResponse) => {
|
||||
.then((baseResponse) => {
|
||||
if (!clientOverride) {
|
||||
// Return the base page if there are no client override.
|
||||
return await processPageData(baseResponse, null);
|
||||
return processPageData(baseResponse, null);
|
||||
}
|
||||
// Else get the client override page.
|
||||
const pageName = `${issPage}_${clientName.toLowerCase().replace(/ /g, '')}`;
|
||||
|
|
@ -187,11 +187,10 @@ export async function fetchCmsContentForPage(issPage) {
|
|||
(clientResponse) =>
|
||||
// Process the client override if it exists.
|
||||
processPageData(baseResponse, clientResponse),
|
||||
async (error) => {
|
||||
(error) => {
|
||||
console.error(error);
|
||||
// Process the just the base if no client override exists.
|
||||
var x = await processPageData(baseResponse, null);
|
||||
return x;
|
||||
return processPageData(baseResponse, null);
|
||||
}
|
||||
);
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue