Split admin login into its own route and add auth guard to /admin
Deploy with Docker Compose / deploy (push) Successful in 28s
Deploy with Docker Compose / deploy (push) Successful in 28s
- Add /admin/login route for Login.vue as a standalone page - Add requiresAdmin guard to /admin route - Update auth guard redirect to /admin/login with redirect query param - Update nginx @auth_denied to redirect to /admin/login - Remove Login component from Admin.vue; drop v-if auth checks (guard handles access) - Remove stale view files from old views/ structure (moved in prior commit) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -22,10 +22,16 @@ const router = createRouter({
|
||||
name: "home",
|
||||
component: () => import("@/views/home/Home.vue"),
|
||||
},
|
||||
{
|
||||
path: "admin/login",
|
||||
name: "admin-login",
|
||||
component: () => import("@/views/admin/Login.vue"),
|
||||
},
|
||||
{
|
||||
path: "admin",
|
||||
name: "admin",
|
||||
component: () => import("@/views/admin/Admin.vue"),
|
||||
meta: { requiresAdmin: true },
|
||||
},
|
||||
{
|
||||
path: "bookmarks",
|
||||
@@ -94,7 +100,7 @@ router.beforeEach(async (to) => {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (!useAuthStore().user.admin) return "/admin";
|
||||
if (!useAuthStore().user.admin) return { path: "/admin/login", query: { redirect: to.fullPath } };
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user