update: auth & update modal

This commit is contained in:
2023-01-30 17:48:28 +01:00
parent ef72c5f129
commit 07e7995ad5
8 changed files with 880 additions and 753 deletions
+22 -32
View File
@@ -1,32 +1,22 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'ManagerView',
component: () => import('./views/ManagerView.vue'),
},
{
path: '/login',
name: 'LoginView',
component: () => import('./views/LoginView.vue'),
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
router.beforeEach((to, from, next) => {
const token = window.localStorage.getItem('auth-token');
if (!token && to.path != '/login') return next({ path: '/login' });
if (token && to.path == '/login') return next({ path: '/' });
// else if (to.path == '/login') return next({ path: '/' });
return next();
});
export default router;
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'ManagerView',
component: () => import('./views/ManagerView.vue'),
},
{
path: '/login',
name: 'LoginView',
component: () => import('./views/LoginView.vue'),
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;