1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

чиним билд04

This commit is contained in:
MoonTestUse1
2025-01-02 01:50:12 +06:00
parent 9a1d9902a8
commit 91ffcbe5b1
4 changed files with 149 additions and 2 deletions

View File

@@ -55,6 +55,12 @@ const router = createRouter({
path: '/admin/login',
name: 'AdminLogin',
component: () => import('@/views/admin/AdminLoginView.vue')
},
{
path: '/requests',
name: 'requests',
component: () => import('@/views/RequestsView.vue'),
meta: { requiresAuth: true }
}
]
});
@@ -64,6 +70,12 @@ router.beforeEach((to, _, next) => {
if (to.meta.requiresAdmin && !authStore.isAdmin) {
next({ name: 'AdminLogin' });
} else if (to.meta.requiresAuth) {
const token = localStorage.getItem('token');
if (!token) {
next('/login');
return;
}
} else {
next();
}