fix: Revert dashboard routing to use existing structure
Build And Push Image / docker (push) Successful in 1m49s
Details
Build And Push Image / docker (push) Successful in 1m49s
Details
- Created missing admin.ts middleware file
- Reverted dashboard router to use old /dashboard/{tier} structure
- Production deployment still uses the old structure
- New role-based structure (/admin/dashboard, etc.) will be enabled later
- Fixes dashboard display issue where nothing was showing
The new structure is ready but needs gradual deployment to avoid breaking production.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8b1dd4d083
commit
7c49b9db66
|
|
@ -28,7 +28,8 @@
|
|||
"Bash(npm run dev:*)",
|
||||
"Bash(New-Item -Path \"Z:\\Repos\\monacousa-portal\\pages\\admin\\dashboard\\index.vue\" -ItemType File -Force)",
|
||||
"Bash(grep:*)",
|
||||
"Bash(findstr:*)"
|
||||
"Bash(findstr:*)",
|
||||
"mcp__playwright__browser_close"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
// middleware/admin.ts
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const { isAuthenticated, isAdmin } = useAuth();
|
||||
|
||||
// Check if user is authenticated
|
||||
if (!isAuthenticated.value) {
|
||||
return navigateTo('/login');
|
||||
}
|
||||
|
||||
// Check if user has admin privileges
|
||||
if (!isAdmin.value) {
|
||||
throw createError({
|
||||
statusCode: 403,
|
||||
statusMessage: 'Access denied. Administrator privileges required.'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -31,16 +31,8 @@ onMounted(() => {
|
|||
|
||||
// Auth middleware has already verified authentication - route based on highest privilege
|
||||
if (user.value && userTier.value) {
|
||||
let targetRoute = '/member/dashboard';
|
||||
|
||||
// Route to the highest privilege level section
|
||||
if (userTier.value === 'admin') {
|
||||
targetRoute = '/admin/dashboard';
|
||||
} else if (userTier.value === 'board') {
|
||||
targetRoute = '/board/dashboard';
|
||||
} else {
|
||||
targetRoute = '/member/dashboard';
|
||||
}
|
||||
// Use old structure for now until new pages are fully deployed
|
||||
let targetRoute = `/dashboard/${userTier.value}`;
|
||||
|
||||
console.log('🔄 Routing to role-specific dashboard:', targetRoute);
|
||||
navigateTo(targetRoute, { replace: true });
|
||||
|
|
|
|||
Loading…
Reference in New Issue