yo-next-auth/hooks/useCurrentRole.ts

7 lines
151 B
TypeScript

import { useSession } from 'next-auth/react'
export const useCurrentRole = () => {
const session = useSession()
return session.data?.user?.role
}