common Routes

pull/1/head
saeid_01 5 years ago
parent 35d9b702b5
commit 3fae15df24

@ -1,7 +1,7 @@
{
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=bd838299c7139fbdb561",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=d118d60bd7ce77638280",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=5a36e23c9b03ed5944b0",
"/js/vue/Modules/Reservation/app.js": "/js/vue/Modules/Reservation/app.js?id=028a37c865b0df2e3e12",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=45e54dcc60aa7e6f6749"
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js",
"/js/vue/Home/app.js": "/js/vue/Home/app.js",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js",
"/js/vue/Modules/Reservation/app.js": "/js/vue/Modules/Reservation/app.js",
"/js/vue/User/app.js": "/js/vue/User/app.js"
}

@ -2,6 +2,8 @@ import axios from "axios";
import { TokenService } from "@Global/services/storage.services";
import ApiService from "@Global/services/api.services";
import store from "@Core/store/index";
import commonRoute from "@Global/utils/common/routes";
function errorResponseHandler(error) {
// check for errorHandle config
@ -18,7 +20,7 @@ function errorResponseHandler(error) {
TokenService.removeToken();
ApiService.removeAuthHeader();
store.commit('auth/logout', {}, {root: true})
window.location.href = '/Login';
window.location.href = commonRoute.login;
}
}
}

@ -0,0 +1,8 @@
export default {
login: () => {
return process.env.MIX_PUSHER_APP_ROUTE_LOGIN || "/WE-Login";
},
main: () => {
return process.env.MIX_PUSHER_APP_ROUTE_MAIN || "/Main/Home";
}
}

@ -56,6 +56,7 @@ Vue.use(Meta)
import { TokenService } from "@Global/services/storage.services";
import commonRoute from "@Global/utils/common/routes";
router.beforeEach((to, from, next) => {
const isPublic = to.matched.some(record => record.meta.public);
const onlyWhenLoggedOut = to.matched.some(
@ -65,12 +66,12 @@ router.beforeEach((to, from, next) => {
const loggedIn = !!TokenService.getToken();
if (!isPublic && !loggedIn) {
return window.location.href = '/Login?redirect='+to.fullPath;
return window.location.href = commonRoute.login + '?redirect='+to.fullPath;
}
// Do not allow user to visit login page or register page if they are logged in
if (loggedIn && onlyWhenLoggedOut && policy) {
return window.location.href = '/Main';
return window.location.href = commonRoute.main;
}
next();

Loading…
Cancel
Save