added tons of features
This commit is contained in:
26
components/(protected)/admin/auth/permission.tsx
Normal file
26
components/(protected)/admin/auth/permission.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import {UserRole} from '@prisma/client'
|
||||
import {notFound} from 'next/navigation'
|
||||
|
||||
import {auth} from '@/auth'
|
||||
import LoginForm from '@/components/auth/forms/login-form'
|
||||
import {SessionUser} from '@/types/auth'
|
||||
|
||||
export default async function AdminPermission() {
|
||||
const session = await auth()
|
||||
const user: SessionUser = session?.user as unknown as SessionUser
|
||||
|
||||
if (!user) {
|
||||
return (
|
||||
<div className='my-8'>
|
||||
<div className='container flex flex-col sm:flex-row'>
|
||||
<LoginForm />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
//if (![UserRole.CUSTOMER].includes(user.role as 'CUSTOMER')) {
|
||||
if (user.role !== UserRole.SUPERVISOR) {
|
||||
notFound()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user