diff --git a/src/app/(payload)/access/isAdmin.ts b/src/app/(payload)/access/isAdmin.ts index bcbb7f3..5751efb 100644 --- a/src/app/(payload)/access/isAdmin.ts +++ b/src/app/(payload)/access/isAdmin.ts @@ -1,7 +1,7 @@ -import { Access, FieldAccess } from 'payload/types' +import { Access } from 'payload/types' import type { User } from 'types/payload-types' -export const isAdmin = ({ req: { user } }) => { +export const isAdmin = ({ req: { user } }: any) => { if (user && user.roles?.includes('admin')) { return true } @@ -9,7 +9,7 @@ export const isAdmin = ({ req: { user } }) => { return false } -export const isAdminOrCreatedBy = ({ req: { user } }) => { +export const isAdminOrCreatedBy = ({ req: { user } }: any) => { if (user && user.role === 'admin') { return true } @@ -25,7 +25,7 @@ export const isAdminOrCreatedBy = ({ req: { user } }) => { return false } -export const isAdminOrSelf = ({ req: { user } }) => { +export const isAdminOrSelf = ({ req: { user } }: any) => { if (user) { if (user.roles?.includes('admin')) { return true diff --git a/src/app/(payload)/access/isEditor.ts b/src/app/(payload)/access/isEditor.ts index 2ce8d71..d03dd74 100644 --- a/src/app/(payload)/access/isEditor.ts +++ b/src/app/(payload)/access/isEditor.ts @@ -1,7 +1,7 @@ import { Access, FieldAccess } from 'payload/types' import type { User } from 'types/payload-types' -export const isEditor = ({ req: { user } }) => { +export const isEditor = ({ req: { user } }: any) => { if (user?.roles?.some((role) => ['editor', 'admin'].includes(role))) { return true } diff --git a/src/app/(payload)/access/isUser.ts b/src/app/(payload)/access/isUser.ts index 7c33d30..18cede9 100644 --- a/src/app/(payload)/access/isUser.ts +++ b/src/app/(payload)/access/isUser.ts @@ -1,8 +1,8 @@ import { Access, FieldAccess } from 'payload/types' import type { User } from 'types/payload-types' -export const isUser = ({ req: { user } }) => { - if (user?.roles?.some((role) => ['user', 'editor', 'admin'].includes(role))) { +export const isUser = ({ req: { user } }: any) => { + if (user && user?.roles?.some((role: string) => ['user', 'editor', 'admin'].includes(role))) { return true }