MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / fetchSubscriptionData

Function fetchSubscriptionData

cli/src/hooks/use-subscription-query.ts:17–35  ·  view source on GitHub ↗
(
  logger: Logger = defaultLogger,
)

Source from the content-addressed store, hash-verified

15}
16
17export async function fetchSubscriptionData(
18 logger: Logger = defaultLogger,
19): Promise<SubscriptionResponse> {
20 const client = getApiClient()
21 const response = await client.get<SubscriptionResponse>(
22 '/api/user/subscription',
23 { includeCookie: true },
24 )
25
26 if (!response.ok) {
27 logger.debug(
28 { status: response.status },
29 'Failed to fetch subscription data',
30 )
31 throw new Error(`Failed to fetch subscription: ${response.status}`)
32 }
33
34 return response.data!
35}
36
37export interface UseSubscriptionQueryDeps {
38 logger?: Logger

Callers 1

useSubscriptionQueryFunction · 0.85

Calls 1

getApiClientFunction · 0.90

Tested by

no test coverage detected