mirror of
https://github.com/supabase/supabase.git
synced 2026-05-07 17:30:25 -04:00
18 lines
553 B
TypeScript
18 lines
553 B
TypeScript
import { components } from 'api-types'
|
|
import { hasConsented } from 'common'
|
|
|
|
import { IS_PLATFORM } from './constants'
|
|
import { handleError, post } from '@/data/fetchers'
|
|
|
|
type TrackFeatureFlagVariables = components['schemas']['TelemetryFeatureFlagBody']
|
|
|
|
export async function trackFeatureFlag(body: TrackFeatureFlagVariables) {
|
|
const consent = hasConsented()
|
|
|
|
if (!consent || !IS_PLATFORM) return undefined
|
|
const { data, error } = await post(`/platform/telemetry/feature-flags/track`, { body })
|
|
|
|
if (error) handleError(error)
|
|
return data
|
|
}
|