Skip to content

Commit 747af0a

Browse files
committed
Admin guard panel
1 parent b0e8a2c commit 747af0a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

resources/js/atomjoy/auth/router/routes.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const routes = [
2525
path: '/logout',
2626
name: 'logout',
2727
component: () => import('@/atomjoy/auth/LogoutView.vue'),
28+
meta: { requiresAuth: true },
2829
},
2930
// Two factor
3031
{
@@ -53,13 +54,6 @@ const routes = [
5354
component: () => import('@/atomjoy/auth/AdminLoginView.vue'),
5455
meta: { adminRoute: true },
5556
},
56-
// Admin logout
57-
{
58-
path: '/admin/logout',
59-
name: 'admin.logout',
60-
component: () => import('@/atomjoy/auth/AdminLogoutView.vue'),
61-
meta: { adminRoute: true },
62-
},
6357
// Admin Two factor
6458
{
6559
path: '/admin/login/f2a/:hash',
@@ -74,6 +68,13 @@ const routes = [
7468
component: () => import('@/atomjoy/auth/AdminPasswordView.vue'),
7569
meta: { adminRoute: true },
7670
},
71+
// Admin logout
72+
{
73+
path: '/admin/logout',
74+
name: 'admin.logout',
75+
component: () => import('@/atomjoy/auth/AdminLogoutView.vue'),
76+
meta: { adminRoute: true, requiresAdmin: true },
77+
},
7778
]
7879

7980
export default routes

resources/js/router/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ router.beforeEach(async (to, from, next) => {
4747
// ✅ This will work make sure the correct store is used for the current running app
4848
const auth = useAuthStore()
4949
// ✅ Login with remember me token and/or check is user authenticated
50-
if (to.meta.requiresAdmin) {
50+
if (to.meta.adminRoute) {
5151
await auth.isAuthenticatedAdmin()
5252
} else {
5353
await auth.isAuthenticated()

0 commit comments

Comments
 (0)