diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 925d77d..389a2e6 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,5 +1,6 @@ diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 0987df4..4f7226e 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -19,27 +19,27 @@ const routes = [ { path: '/login', component: () => import('../views/auth/LoginView.vue'), - meta: { public: true }, + meta: { public: true, layout: 'auth' }, }, { path: '/register', component: () => import('../views/auth/RegisterView.vue'), - meta: { public: true }, + meta: { public: true, layout: 'auth' }, }, { path: '/password-reset', component: () => import('../views/auth/PasswordResetView.vue'), - meta: { public: true }, + meta: { public: true, layout: 'auth' }, }, { path: '/password-reset/confirm', component: () => import('../views/auth/NewPasswordView.vue'), - meta: { public: true }, + meta: { public: true, layout: 'auth' }, }, // Phase 2 — authenticated routes - { path: '/account', component: () => import('../views/AccountView.vue') }, - { path: '/admin', component: () => import('../views/AdminView.vue') }, + { path: '/account', redirect: '/settings' }, + { path: '/admin', component: () => import('../views/AdminView.vue'), meta: { requiresAdmin: true } }, // Cloud storage overview and folder browser { @@ -87,6 +87,10 @@ router.beforeEach(async (to) => { return { path: '/login', query: { redirect: to.fullPath } } } } + + if (to.meta.requiresAdmin && authStore.user?.role !== 'admin') { + return { path: '/' } + } }) export default router