completionId: cgen-7915b7bcda044042b76cba6e43b9fe3b
cgen-7915b7bcda044042b76cba6e43b9fe3b
This commit is contained in:
parent
8399b8d17e
commit
d2f63ce70b
1 changed files with 8 additions and 6 deletions
|
|
@ -57,13 +57,15 @@ import {
|
|||
} from "lucide-react";
|
||||
|
||||
export default function Admin() {
|
||||
const { user, loading, roles } = useAuth();
|
||||
const { user, loading } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const ownerEmail = "mrpiglr@gmail.com";
|
||||
const normalizedEmail = user?.email?.toLowerCase() ?? "";
|
||||
const isOwner =
|
||||
(Array.isArray(roles) && roles.includes("owner")) ||
|
||||
normalizedEmail === ownerEmail;
|
||||
|
||||
// Redirect to login if not authenticated
|
||||
useEffect(() => {
|
||||
if (!loading && !user) {
|
||||
navigate("/login", { replace: true });
|
||||
}
|
||||
}, [user, loading, navigate]);
|
||||
const [managedProfiles, setManagedProfiles] = useState<AethexUserProfile[]>(
|
||||
[],
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue