Site header proof of concept
Left some console logs in I think this can be moved out of store to a cms helper class that manages this global data.
This commit is contained in:
parent
7648904408
commit
fb8799fe6b
3 changed files with 27 additions and 5 deletions
|
|
@ -24,6 +24,7 @@
|
|||
<script>
|
||||
import menuModal from '@/iss-components/site-header/menu-modal/menu-modal.vue';
|
||||
import alert from '@/ux-components/alert/alert.vue';
|
||||
import { useMainStore } from '@/store';
|
||||
import eventBus from '@/helpers/event-bus/event-bus';
|
||||
import { globalEvents } from '@/constants/events';
|
||||
|
||||
|
|
@ -85,7 +86,7 @@ export default ({
|
|||
},
|
||||
methods: {
|
||||
setupHeader() {
|
||||
const answers = this.getCmsContent(this.cmsWidgetName, 'Answers');
|
||||
const answers = useMainStore().issConfig.issCmsContent.SiteHeaderWidget.Answers;
|
||||
if (Array.isArray(answers)) {
|
||||
this.headerAnswers = answers.filter((x) => x.AccountNumber == this.mainStore.issConfig.parentAccountNumber)[0];
|
||||
this.headerAnswers = !this.headerAnswers ? answers.filter((x) => x.AccountNumber === '0')[0] : this.headerAnswers;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
<script>
|
||||
// Supporting files
|
||||
import issPageValues from '@/router/router-constants/issPage-values';
|
||||
import { fetchCmsContentForPage } from '@/helpers/cms-content-helper';
|
||||
import settleAllPromises from '@/helpers/layout-helper';
|
||||
import { validateISSClientTag, validateISSClientSignature } from '@/helpers/clientauth-helper';
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
|
|
@ -25,6 +27,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
issCmsContent: [],
|
||||
unauthorized: false
|
||||
};
|
||||
},
|
||||
|
|
@ -64,12 +67,10 @@ export default {
|
|||
|
||||
if (resp?.data.active && resp?.data.accountName.length > 0) {
|
||||
if (resp.data.authentication === 'RSAToken') {
|
||||
const token = queryStringParams.token;
|
||||
const signature = queryStringParams.signature;
|
||||
|
||||
const { token, signature } = queryStringParams;
|
||||
const vsigResp = await validateISSClientSignature(clientTag, token, signature);
|
||||
this.mainStore.issConfig.isAuthenticated = vsigResp?.data?.valid ?? false;
|
||||
|
||||
this.mainStore.issConfig.isAuthenticated = vsigResp?.data?.valid ?? false;
|
||||
if (this.mainStore.issConfig.isAuthenticated) {
|
||||
authorized = true;
|
||||
}
|
||||
|
|
@ -78,6 +79,7 @@ export default {
|
|||
}
|
||||
|
||||
if (authorized) {
|
||||
await this.populateISSCmsComponents(resp.data.parentAccountNumber);
|
||||
await this.populateISSConfigValues(resp.data);
|
||||
|
||||
if (resp.data.parameters?.length > 0) {
|
||||
|
|
@ -95,6 +97,24 @@ export default {
|
|||
window.location = `/?issPage=${issPageValues.WELCOME_PAGE}`;
|
||||
}
|
||||
},
|
||||
async populateISSCmsComponents(accountNumber) {
|
||||
console.log('get global cms components...');
|
||||
console.log(accountNumber);
|
||||
const cmsContentPromise = fetchCmsContentForPage('iss-siteheader');
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: 'cmsContent',
|
||||
promise: cmsContentPromise
|
||||
}
|
||||
];
|
||||
|
||||
// use resultMap to populate layout content.
|
||||
const resultMap = await settleAllPromises(promiseResultMap);
|
||||
const issCmsContent = resultMap.cmsContent;
|
||||
this.mainStore.issConfig.issCmsContent = issCmsContent;
|
||||
},
|
||||
async populateISSConfigValues(data) {
|
||||
this.mainStore.issConfig.clientName = data.accountName;
|
||||
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ const getDefaultState = () => ({
|
|||
issConfig: {
|
||||
clientName: 'Generic Insurance', // this is the default and will be overriden by the client's name
|
||||
clientDisplayName: 'Generic Insurance', // this is the default and will be overridden by the client's name or client display name.
|
||||
issCmsContent: [],
|
||||
styleSheet: '', // Stylesheet used by the client.
|
||||
parentAccountNumber: 0, // Parent account number used by the client.
|
||||
isCoverageEnabled: false, // Indicates if we should be calling coverage on this flow.
|
||||
|
|
|
|||
Loading…
Reference in a new issue