Only check roles if a user when accessing pages
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
tobias 2024-07-06 19:57:55 +02:00
parent 90f1750945
commit 8d05864c15

View File

@ -51,8 +51,10 @@ export const isAdminOrSelf = ({ req: { user } }: any) => {
} }
export const isAdminOrPublished = ({ req: { user } }: any) => { export const isAdminOrPublished = ({ req: { user } }: any) => {
if (user.roles?.includes('admin')) { if (user && user.roles) {
return true if (user.roles?.includes('admin')) {
return true
}
} }
return { return {