diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index 0a2a2815..6c965d36 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -55,7 +55,7 @@ function handleError(action, error, route, reject) { "notify-warning", window.$gz.locale.get("ErrorUserNotAuthorized") ); - router.push("/home-dashboard"); + router.push(window.$gz.store.state.homePage); return reject("[ErrorUserNotAuthorized]"); } diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index 9c3a7e78..9ee328ab 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -51,6 +51,9 @@ export default function initialize() { key: key++ }); + //Set homePage in store to dashboard + window.$gz.store.commit("setHomePage", "/home-dashboard"); + //SEARCH if ( window.$gz.role.hasRole([ @@ -609,6 +612,12 @@ export default function initialize() { key: key++ }); + //Set home page if they don't already have the dashboard set above + if (!window.$gz.store.state.homePage) { + //Set homePage in store to Backup + window.$gz.store.commit("setHomePage", "/ops-BACKUP"); + } + // JOBS sub.push({ title: window.$gz.locale.get("ServerJobs"), diff --git a/ayanova/src/store.js b/ayanova/src/store.js index 0ff7f984..d8c06418 100644 --- a/ayanova/src/store.js +++ b/ayanova/src/store.js @@ -17,6 +17,7 @@ export default new Vuex.Store({ userId: 0, userName: "NOT AUTHENTICATED", roles: 0, + homePage: undefined, localeText: {}, locale: { decimalSeparator: ".", @@ -47,6 +48,7 @@ export default new Vuex.Store({ state.userId = 0; state.userName = "NOT AUTHENTICATED"; state.roles = 0; + state.homePage = undefined; state.navItems = []; state.localeText = {}; state.formCustomTemplate = {}; @@ -102,6 +104,9 @@ export default new Vuex.Store({ }, clearFormSettings(state, formKey) { delete state.formSettings[formKey]; + }, + setHomePage(state, data) { + state.homePage = data; } }, actions: {} diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index 0448e17e..57c26cb8 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -93,7 +93,7 @@ export default { auth .authenticate(this.input.username, this.input.password) .then(() => { - vm.$router.push("/home-dashboard"); + vm.$router.push(vm.$store.state.homePage); }) .catch(function handleCaughtLoginError(error) { /* xeslint-disable-next-line */