Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion frontend/client/components/auth/AdminGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useEffect, useRef, useSyncExternalStore } from "react";
import { useRouter } from "next/navigation";
import { useAuthStore } from "@/stores/authStore";
import { normalizeRole } from "@/lib/auth/role";
import { isAdminHost } from "@/lib/host";

type Props = {
Expand All @@ -14,7 +15,9 @@ function subscribe() {
}

function isAdmin(role: unknown): boolean {
return role === "admin" || role === 2;
// The API returns the role as PascalCase ("Admin"); normalize so the check is
// case/format-insensitive (string or numeric enum).
return normalizeRole(role) === "admin";
}

export function AdminGuard({ children }: Props) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/client/hooks/useGettingStartedChecklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useMemo, useState, useEffect, useCallback } from "react";
import { useQuery, useQueryClient, type InfiniteData } from "@tanstack/react-query";
import { useAuthStore } from "@/stores/authStore";
import { normalizeRole } from "@/lib/auth/role";
import { useMyInvitations } from "@/hooks/useProjects";
import { useProfileCompleteness } from "@/hooks/useProfileCompleteness";
import { fetchProjects } from "@/lib/api/projects";
Expand Down Expand Up @@ -82,7 +83,7 @@ export function useGettingStartedChecklist() {
}, [qc]);

const items: ChecklistItem[] = useMemo(() => {
const isEnterprise = role === "enterprise" || role === 1;
const isEnterprise = normalizeRole(role) === "enterprise";

if (isEnterprise) {
return [
Expand Down
Loading