manifold/web/hooks/use-admin.ts
Marshall Polaris 3cb28cdecb
Teach AuthContext to manage the private user doc (#738)
* Return both user and privateUser from `createuser`

* Make `useStateCheckEquality` more flexible

* Make `AuthContext` track the private user doc

* Change `usePrivateUser` hook to use the auth context data

* Pass both user and private user through SSR to auth context

* Fix bug in create user flow
2022-08-12 13:41:00 -07:00

8 lines
209 B
TypeScript

import { isAdmin } from 'common/envs/constants'
import { usePrivateUser } from './use-user'
export const useAdmin = () => {
const privateUser = usePrivateUser()
return isAdmin(privateUser?.email || '')
}