Skip to content

Commit

Permalink
chore: add admin guard file that I forgot to add #199
Browse files Browse the repository at this point in the history
  • Loading branch information
bsilkyn committed Apr 20, 2024
1 parent fe09813 commit c853106
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/src/router/guards/admin.guard.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useAuthStore } from '@/store/authentication.store.ts';
import { type RouteLocationRaw } from 'vue-router';

export function AdminGuard(): boolean | RouteLocationRaw {
const { user } = useAuthStore();
if (user?.is_staff ?? false) {
return true;
}
return 'dashboard';
}

0 comments on commit c853106

Please sign in to comment.