init frontend_management
This commit is contained in:
parent
af58550f7f
commit
62812f2090
23 changed files with 13174 additions and 0 deletions
7
frontend_management/middleware/admin.ts
Normal file
7
frontend_management/middleware/admin.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const authStore = useAuthStore();
|
||||
authStore.checkAuth();
|
||||
if (!authStore.isAdmin) {
|
||||
return navigateTo('/login');
|
||||
}
|
||||
});
|
||||
7
frontend_management/middleware/auth.ts
Normal file
7
frontend_management/middleware/auth.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const authStore = useAuthStore();
|
||||
authStore.checkAuth();
|
||||
if (!authStore.isAuthenticated) {
|
||||
return navigateTo('/login');
|
||||
}
|
||||
});
|
||||
7
frontend_management/middleware/instructor.ts
Normal file
7
frontend_management/middleware/instructor.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
const authStore = useAuthStore();
|
||||
authStore.checkAuth();
|
||||
if (!authStore.isInstructor) {
|
||||
return navigateTo('/login');
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue