diff --git a/src/auth/auth.composable.js b/src/auth/auth.composable.js index de6745e..d1b1e5c 100644 --- a/src/auth/auth.composable.js +++ b/src/auth/auth.composable.js @@ -31,11 +31,11 @@ export function useAuth() { const isAuthenticated = computed(() => !!jwt.value); const payload = computed(() => decodeJwt(jwt.value)?.payload); - const canUserAdmin = computed(() => - canAdmin(payload.value, "other", "mink-app") + const canUserAdmin = computed( + () => payload.value && canAdmin(payload.value, "other", "mink-app") ); - const canUserWrite = computed(() => - canWrite(payload.value, "other", "mink-app") + const canUserWrite = computed( + () => payload.value && canWrite(payload.value, "other", "mink-app") ); /** If not authenticated, redirect to the login page. */