mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix(projects): fire useProjects hook for all authenticated users, not just admins
This commit is contained in:
parent
740bb44796
commit
00c6e33a15
1 changed files with 2 additions and 4 deletions
|
|
@ -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),
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue