CASH-109 tech review recommendations
Use router.push to navigate to return-user page
This commit is contained in:
parent
bfc0eda484
commit
5d014a2262
4 changed files with 13 additions and 40 deletions
|
|
@ -148,7 +148,7 @@ export default {
|
||||||
position: relative;
|
position: relative;
|
||||||
color: $black;
|
color: $black;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: .25rem;
|
border-radius: 0.25rem;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ import store from "@/store";
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
import { applicationConfig } from "../constants/application-config";
|
import { applicationConfig } from "../constants/application-config";
|
||||||
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper";
|
||||||
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
|
import router from "@/router/index.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -721,7 +723,10 @@ export default {
|
||||||
funnelCookieLastTouched !== undefined
|
funnelCookieLastTouched !== undefined
|
||||||
) {
|
) {
|
||||||
await this.initSession();
|
await this.initSession();
|
||||||
window.location.href = applicationConfig.RETURN_USER_PAGE;
|
router.push({
|
||||||
|
path: "/",
|
||||||
|
query: { fmgPage: fmgPageValues.RETURN_USER },
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,11 @@ const routes = [
|
||||||
funnelCookieLastTouched !== undefined
|
funnelCookieLastTouched !== undefined
|
||||||
) {
|
) {
|
||||||
log(" --navigate to return user");
|
log(" --navigate to return user");
|
||||||
NavigateToReturnUser(next, to);
|
router.push({
|
||||||
|
path: "/",
|
||||||
|
query: { fmgPage: fmgPageValues.RETURN_USER },
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the saveSessionPromise - if it exists in the vuex store but a new instance was created
|
// clear the saveSessionPromise - if it exists in the vuex store but a new instance was created
|
||||||
|
|
@ -651,42 +655,6 @@ function GetRouteInfoFromPageName(pageName) {
|
||||||
return routeData;
|
return routeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function NavigateToReturnUser(next, to) {
|
|
||||||
const returnRoute = GetRouteInfoFromPageName(fmgPageValues.RETURN_USER);
|
|
||||||
log("--returnRoute:", returnRoute);
|
|
||||||
|
|
||||||
if (router.hasRoute(to.query.fmgPage)) {
|
|
||||||
// Since our route is already in scope, we can grab the component from it and call the arePagePrerequisitesValid function.
|
|
||||||
let component = router
|
|
||||||
.getRoutes()
|
|
||||||
.filter((x) => x.name === fmgPageValues.RETURN_USER)[0].components;
|
|
||||||
|
|
||||||
log("--return-user component:", component);
|
|
||||||
|
|
||||||
// If the component hasn't been loaded fully, load it before we check prerequisites.
|
|
||||||
if (component.default.methods === undefined) {
|
|
||||||
component = await component.default();
|
|
||||||
}
|
|
||||||
|
|
||||||
log(" --has route for return-user:", fmgPageValues.RETURN_USER);
|
|
||||||
return next({ name: fmgPageValues.RETURN_USER, query: to.query, params: to.params });
|
|
||||||
} else {
|
|
||||||
log(" --add route for return-user:", fmgPageValues.RETURN_USER);
|
|
||||||
router.addRoute({
|
|
||||||
path: returnRoute[0].path, // Always the same path, because we control it with query strings.
|
|
||||||
name: returnRoute[0].name,
|
|
||||||
component: returnRoute[0].component,
|
|
||||||
});
|
|
||||||
|
|
||||||
next({
|
|
||||||
name: returnRoute[0].name,
|
|
||||||
query: Object.assign(to.query, { fmgPage: returnRoute[0].name }),
|
|
||||||
params: to.params,
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go to our start page on a 404.
|
// Go to our start page on a 404.
|
||||||
function GoToFunnelStartOn404(next, errorPayload = null) {
|
function GoToFunnelStartOn404(next, errorPayload = null) {
|
||||||
if (errorPayload !== null) {
|
if (errorPayload !== null) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
:class="[
|
:class="[
|
||||||
isPrimary ? 'btn-primary' : 'btn-secondary',
|
isPrimary ? 'btn-primary' : 'btn-secondary',
|
||||||
isFloat ? 'float-end' : '',
|
isFloat ? 'float-end' : '',
|
||||||
(isLoaderDisplayed && !suppressLoader) ? 'has-loader' : '',
|
isLoaderDisplayed && !suppressLoader ? 'has-loader' : '',
|
||||||
]"
|
]"
|
||||||
@click="clicked">
|
@click="clicked">
|
||||||
<span class="m-0">{{ this.buttonText }}</span>
|
<span class="m-0">{{ this.buttonText }}</span>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue