mirror of
https://github.com/supabase/supabase.git
synced 2026-05-30 17:32:00 +08:00
* Check for profile in projects, organizations and permissions query * Remove unused telemetry function
20 lines
671 B
TypeScript
20 lines
671 B
TypeScript
import { components } from 'api-types'
|
|
import { LOCAL_STORAGE_KEYS } from 'common'
|
|
import { handleError, post } from 'data/fetchers'
|
|
import { IS_PLATFORM } from './constants'
|
|
|
|
type TrackFeatureFlagVariables = components['schemas']['TelemetryFeatureFlagBodyDto']
|
|
|
|
export async function trackFeatureFlag(body: TrackFeatureFlagVariables) {
|
|
const consent =
|
|
(typeof window !== 'undefined'
|
|
? localStorage.getItem(LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT)
|
|
: null) === 'true'
|
|
|
|
if (!consent || !IS_PLATFORM) return undefined
|
|
const { data, error } = await post(`/platform/telemetry/feature-flags/track`, { body })
|
|
|
|
if (error) handleError(error)
|
|
return data
|
|
}
|