Added unauthorized message block. Code refactoring.
This commit is contained in:
parent
5fd6dfeff9
commit
5fdc2b7fa7
2 changed files with 19 additions and 53 deletions
|
|
@ -1,25 +1,20 @@
|
|||
<template>
|
||||
|
||||
<p id="message" v-show="unauthorized">Unauthorized Access.</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Components
|
||||
import { useRoute } from 'vue-router';
|
||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import { validateISSClientTag } from "@/helpers/clientauth-helper";
|
||||
import siteHeader from '@/iss-components/site-header/site-header';
|
||||
import siteSubHeader from '@/iss-components/site-sub-header/site-sub-header';
|
||||
import siteFooter from "@/iss-components/site-footer/site-footer";
|
||||
import textBlock from "@/digital-components/text-block/text-block";
|
||||
|
||||
// Supporting files
|
||||
import { issPageValues } from "@/router/router-constants/issPage-values";
|
||||
import { validateISSClientTag } from "@/helpers/clientauth-helper";
|
||||
import { useMainStore } from '@/store';
|
||||
|
||||
export default {
|
||||
name: "entry-page",
|
||||
mixins: [],
|
||||
data() {
|
||||
return {
|
||||
unauthorized: false,
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const mainStore = useMainStore();
|
||||
|
|
@ -28,29 +23,7 @@
|
|||
},
|
||||
mounted() {
|
||||
this.validateClientTagOnEntry();
|
||||
},
|
||||
/*
|
||||
async beforeRouteEnter(to, from, next)
|
||||
{
|
||||
// Call APIs
|
||||
const cmsContentPromise = fetchCmsContentForPage(to.query.issPage);
|
||||
|
||||
// Settle promises and get results
|
||||
const promiseResultMap = [
|
||||
{
|
||||
resultKey: "cmsContent",
|
||||
promise: cmsContentPromise,
|
||||
},
|
||||
];
|
||||
|
||||
//use resultMap to populate layout content.
|
||||
let resultMap = await settleAllPromises(promiseResultMap);
|
||||
|
||||
next((vm) => {
|
||||
vm.setCmsContent(resultMap.cmsContent);
|
||||
});
|
||||
},
|
||||
*/
|
||||
},
|
||||
methods:
|
||||
{
|
||||
navigateForward() {
|
||||
|
|
@ -62,11 +35,9 @@
|
|||
async validateClientTagOnEntry() {
|
||||
|
||||
const mainStore = useMainStore();
|
||||
|
||||
console.log("Client Name on-load: " + mainStore.issConfig.clientName);
|
||||
|
||||
const clientTag = this.$route.query.ClientTag;
|
||||
const clientTagPresent = !!clientTag;
|
||||
let authorized = false;
|
||||
|
||||
if ( clientTagPresent )
|
||||
{
|
||||
|
|
@ -79,30 +50,28 @@
|
|||
this.mainStore.issConfig.clientName = resp.data.accountName;
|
||||
this.mainStore.issConfig.accountNumber = resp.data.accountNumber;
|
||||
this.mainStore.issConfig.styleSheet = resp.data.styleSheet;
|
||||
authorized = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Client Name after-load: " + mainStore.issConfig.clientName);
|
||||
this.unauthorized = !authorized;
|
||||
|
||||
//this.navigateForward();
|
||||
//this.$router.push({ path: '/?issPage=welcome-page' });
|
||||
|
||||
// Forced full location redirect here. We do not want the entry page as part of the flow/path history.
|
||||
window.location = "/?issPage=welcome-page";
|
||||
if ( authorized )
|
||||
{
|
||||
// Forced full location redirect here. We do not want the entry page as part of the router/flow/path history.
|
||||
window.location = "/?issPage=" + issPageValues.WELCOME_PAGE;
|
||||
}
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
|
||||
computed:{
|
||||
},
|
||||
components: {
|
||||
siteHeader,
|
||||
siteSubHeader,
|
||||
siteFooter,
|
||||
textBlock,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
#message {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -191,9 +191,6 @@
|
|||
// Set order account number from the issConfig.
|
||||
mainStore.order.accountNumber = mainStore.issConfig.accountNumber;
|
||||
|
||||
console.log("issConfig account number: " + mainStore.issConfig.accountNumber);
|
||||
console.log("order account number: " + mainStore.order.accountNumber);
|
||||
|
||||
return { mainStore };
|
||||
},
|
||||
async beforeRouteEnter(to, from, next)
|
||||
|
|
|
|||
Loading…
Reference in a new issue