Skip to content

Commit 8adc16a

Browse files
NicolappsConvex, Inc.
authored and
Convex, Inc.
committed
Don’t call get_current_spend if not an admin (#35275)
GitOrigin-RevId: 36805fb4404e518daa866941ffc422ac5b5086ab
1 parent 29dd36f commit 8adc16a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: npm-packages/dashboard/src/api/billing.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ export function useListPlans(teamId?: number) {
168168
};
169169
}
170170

171-
export function useGetCurrentSpend(teamId: number) {
171+
export function useGetCurrentSpend(teamId: number | null) {
172172
const { data, isLoading } = useBBQuery({
173173
path: "/teams/{team_id}/get_current_spend",
174-
pathParams: { team_id: teamId.toString() },
174+
pathParams: { team_id: teamId?.toString() ?? "" },
175175
swrOptions: {
176176
refreshInterval: 1000 * 60,
177177
},

Diff for: npm-packages/dashboard/src/components/billing/SubscriptionOverview.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function SpendingLimitsSectionContainer({
150150
}) {
151151
const submitSpendingLimits = useSubmitSpendingLimits(team);
152152

153-
const currentSpend = useGetCurrentSpend(team.id);
153+
const currentSpend = useGetCurrentSpend(hasAdminPermissions ? team.id : null);
154154
const { spendingLimits } = useGetSpendingLimits(team.id);
155155

156156
return (

0 commit comments

Comments
 (0)