We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fe09813 commit c853106Copy full SHA for c853106
frontend/src/router/guards/admin.guard.ts
@@ -0,0 +1,10 @@
1
+import { useAuthStore } from '@/store/authentication.store.ts';
2
+import { type RouteLocationRaw } from 'vue-router';
3
+
4
+export function AdminGuard(): boolean | RouteLocationRaw {
5
+ const { user } = useAuthStore();
6
+ if (user?.is_staff ?? false) {
7
+ return true;
8
+ }
9
+ return 'dashboard';
10
+}
0 commit comments