MCPcopy Create free account
hub / github.com/CodebuffAI/codebuff / fetchCurrentBalance

Function fetchCurrentBalance

web/src/hooks/use-auto-topup.ts:13–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11import { clamp } from '@/lib/utils'
12
13async function fetchCurrentBalance(): Promise<number> {
14 const response = await fetch('/api/user/usage')
15 if (!response.ok) throw new Error('Failed to fetch balance')
16 const data = await response.json()
17 return data.balance?.totalRemaining ?? 0
18}
19
20const {
21 MIN_THRESHOLD_CREDITS,

Callers 1

handleToggleAutoTopupFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected