fix(projects): fire useProjects hook for all authenticated users, not just admins

This commit is contained in:
Ishaan Jaffer 2026-04-27 18:47:02 -07:00
parent 740bb44796
commit 00c6e33a15
No known key found for this signature in database

View file

@ -6,7 +6,6 @@ import {
deriveErrorMessage,
handleError,
} from "@/components/networking";
import { all_admin_roles } from "@/utils/roles";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
// ── Types ────────────────────────────────────────────────────────────────────
@ -76,12 +75,11 @@ const fetchProjects = async (
// ── Hook ─────────────────────────────────────────────────────────────────────
export const useProjects = () => {
const { accessToken, userRole } = useAuthorized();
const { accessToken } = useAuthorized();
return useQuery<ProjectResponse[]>({
queryKey: projectKeys.list({}),
queryFn: async () => fetchProjects(accessToken!),
enabled:
Boolean(accessToken) && all_admin_roles.includes(userRole || ""),
enabled: Boolean(accessToken),
});
};