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

Function fetchAnalytics

web/src/app/orgs/[slug]/analytics/page.tsx:78–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76 }, [organization])
77
78 const fetchAnalytics = async () => {
79 if (!organization) return
80
81 try {
82 setAnalyticsLoading(true)
83 const response = await fetch(`/api/orgs/${organization.id}/analytics`)
84
85 if (!response.ok) {
86 const error = await response.json()
87 throw new Error(error.error || 'Failed to fetch analytics')
88 }
89
90 const data = await response.json()
91 setAnalytics(data)
92 } catch (error) {
93 console.error('Error fetching analytics:', error)
94 setAnalyticsError(
95 error instanceof Error ? error.message : 'Failed to load analytics',
96 )
97 } finally {
98 setAnalyticsLoading(false)
99 }
100 }
101
102 const exportData = async (format: 'csv' | 'json') => {
103 if (!organization) return

Callers 1

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected