14 lines
346 B
TypeScript
14 lines
346 B
TypeScript
'use server'
|
|
|
|
import { currentRole } from '@/lib/auth'
|
|
import { UserRole } from '@prisma/client'
|
|
|
|
export const admin = async () => {
|
|
const role = await currentRole()
|
|
|
|
if (role === UserRole.ADMIN) {
|
|
return { success: `Allowed Server Action for ${UserRole.ADMIN}` }
|
|
}
|
|
|
|
return { error: `Forbidden Server Action for ${UserRole.ADMIN}` }
|
|
} |