Skip to content

Commit c853106

Browse files
committed
chore: add admin guard file that I forgot to add #199
1 parent fe09813 commit c853106

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)