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>
|
<template>
|
||||||
|
<p id="message" v-show="unauthorized">Unauthorized Access.</p>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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
|
// Supporting files
|
||||||
|
import { issPageValues } from "@/router/router-constants/issPage-values";
|
||||||
|
import { validateISSClientTag } from "@/helpers/clientauth-helper";
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "entry-page",
|
name: "entry-page",
|
||||||
mixins: [],
|
mixins: [],
|
||||||
data() {
|
data() {
|
||||||
|
return {
|
||||||
|
unauthorized: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
|
|
@ -29,28 +24,6 @@
|
||||||
mounted() {
|
mounted() {
|
||||||
this.validateClientTagOnEntry();
|
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:
|
methods:
|
||||||
{
|
{
|
||||||
navigateForward() {
|
navigateForward() {
|
||||||
|
|
@ -62,11 +35,9 @@
|
||||||
async validateClientTagOnEntry() {
|
async validateClientTagOnEntry() {
|
||||||
|
|
||||||
const mainStore = useMainStore();
|
const mainStore = useMainStore();
|
||||||
|
|
||||||
console.log("Client Name on-load: " + mainStore.issConfig.clientName);
|
|
||||||
|
|
||||||
const clientTag = this.$route.query.ClientTag;
|
const clientTag = this.$route.query.ClientTag;
|
||||||
const clientTagPresent = !!clientTag;
|
const clientTagPresent = !!clientTag;
|
||||||
|
let authorized = false;
|
||||||
|
|
||||||
if ( clientTagPresent )
|
if ( clientTagPresent )
|
||||||
{
|
{
|
||||||
|
|
@ -79,30 +50,28 @@
|
||||||
this.mainStore.issConfig.clientName = resp.data.accountName;
|
this.mainStore.issConfig.clientName = resp.data.accountName;
|
||||||
this.mainStore.issConfig.accountNumber = resp.data.accountNumber;
|
this.mainStore.issConfig.accountNumber = resp.data.accountNumber;
|
||||||
this.mainStore.issConfig.styleSheet = resp.data.styleSheet;
|
this.mainStore.issConfig.styleSheet = resp.data.styleSheet;
|
||||||
|
authorized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Client Name after-load: " + mainStore.issConfig.clientName);
|
this.unauthorized = !authorized;
|
||||||
|
|
||||||
//this.navigateForward();
|
if ( authorized )
|
||||||
//this.$router.push({ path: '/?issPage=welcome-page' });
|
{
|
||||||
|
// Forced full location redirect here. We do not want the entry page as part of the router/flow/path history.
|
||||||
// Forced full location redirect here. We do not want the entry page as part of the flow/path history.
|
window.location = "/?issPage=" + issPageValues.WELCOME_PAGE;
|
||||||
window.location = "/?issPage=welcome-page";
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
siteHeader,
|
|
||||||
siteSubHeader,
|
|
||||||
siteFooter,
|
|
||||||
textBlock,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
#message {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -191,9 +191,6 @@
|
||||||
// Set order account number from the issConfig.
|
// Set order account number from the issConfig.
|
||||||
mainStore.order.accountNumber = mainStore.issConfig.accountNumber;
|
mainStore.order.accountNumber = mainStore.issConfig.accountNumber;
|
||||||
|
|
||||||
console.log("issConfig account number: " + mainStore.issConfig.accountNumber);
|
|
||||||
console.log("order account number: " + mainStore.order.accountNumber);
|
|
||||||
|
|
||||||
return { mainStore };
|
return { mainStore };
|
||||||
},
|
},
|
||||||
async beforeRouteEnter(to, from, next)
|
async beforeRouteEnter(to, from, next)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue