mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-08 14:25:41 +03:00
11 lines
300 B
TypeScript
11 lines
300 B
TypeScript
|
|
import { useContext } from "react";
|
||
|
|
import { AuthContext } from "@/context/auth-context";
|
||
|
|
|
||
|
|
export function useIsAdmin() {
|
||
|
|
const { auth } = useContext(AuthContext);
|
||
|
|
const isAdmin =
|
||
|
|
(auth.isAuthenticated && auth.user?.role === "admin") ||
|
||
|
|
auth.user?.role === undefined;
|
||
|
|
return isAdmin;
|
||
|
|
}
|