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

Function fetchUsageData

web/src/app/orgs/[slug]/usage/page.tsx:62–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 }, [organization])
61
62 const fetchUsageData = async () => {
63 if (!organization) return
64
65 try {
66 setUsageLoading(true)
67 const response = await fetch(`/api/orgs/${organization.id}/usage`)
68
69 if (response.ok) {
70 const usage = await response.json()
71 setUsageData(usage)
72 } else {
73 const error = await response.json()
74 throw new Error(error.error || 'Failed to fetch usage data')
75 }
76 } catch (error) {
77 console.error('Error fetching usage data:', error)
78 setUsageError(
79 error instanceof Error ? error.message : 'Failed to load usage data',
80 )
81 } finally {
82 setUsageLoading(false)
83 }
84 }
85
86 const handleExportUsage = async () => {
87 if (!organization) return

Callers 1

UsagePageFunction · 0.70

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected