8 行
271 B
TypeScript
8 行
271 B
TypeScript
import type { User, UserRole } from '@/types'
|
|
|
|
const CONTENT_EDITOR_ROLES: readonly UserRole[] = ['admin', 'member']
|
|
|
|
export const canEditContent = (
|
|
user: Pick<User, 'role'> | null | undefined,
|
|
): boolean => user != null && CONTENT_EDITOR_ROLES.includes (user.role)
|