diff --git a/web/default/src/features/keys/components/api-keys-columns.tsx b/web/default/src/features/keys/components/api-keys-columns.tsx index cddbea22..2c6544c1 100644 --- a/web/default/src/features/keys/components/api-keys-columns.tsx +++ b/web/default/src/features/keys/components/api-keys-columns.tsx @@ -16,11 +16,9 @@ along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ -import { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import { type ColumnDef } from '@tanstack/react-table' import { useTranslation } from 'react-i18next' -import { useAuthStore } from '@/stores/auth-store' import { getUserGroups } from '@/lib/api' import { formatQuota, formatTimestampToDate } from '@/lib/format' import { cn } from '@/lib/utils' @@ -34,7 +32,6 @@ import { import { DataTableColumnHeader } from '@/components/data-table' import { GroupBadge } from '@/components/group-badge' import { StatusBadge } from '@/components/status-badge' -import { getSystemOptions } from '@/features/system-settings/api' import { API_KEY_STATUSES } from '../constants' import { type ApiKey } from '../types' import { @@ -51,31 +48,9 @@ function getQuotaProgressColor(percentage: number): string { } function useGroupRatios(): Record { - const isAdmin = useAuthStore((s) => - Boolean(s.auth.user?.role && s.auth.user.role >= 10) - ) - - const { data: adminData } = useQuery({ - queryKey: ['system-options-group-ratio'], - queryFn: getSystemOptions, - enabled: isAdmin, - staleTime: 5 * 60 * 1000, - select: (res) => { - if (!res.success || !res.data) return {} - const option = res.data.find((o) => o.key === 'GroupRatio') - if (!option?.value) return {} - try { - return JSON.parse(option.value) as Record - } catch { - return {} - } - }, - }) - - const { data: userGroupsData } = useQuery({ + const { data } = useQuery({ queryKey: ['user-self-groups'], queryFn: getUserGroups, - enabled: !isAdmin, staleTime: 5 * 60 * 1000, select: (res) => { if (!res.success || !res.data) return {} @@ -89,10 +64,7 @@ function useGroupRatios(): Record { }, }) - return useMemo( - () => (isAdmin ? adminData : userGroupsData) ?? {}, - [isAdmin, adminData, userGroupsData] - ) + return data ?? {} } export function useApiKeysColumns(): ColumnDef[] {