mirror of
https://github.com/supabase/supabase.git
synced 2026-07-04 06:44:22 +08:00
26 lines
549 B
TypeScript
26 lines
549 B
TypeScript
import { post } from 'lib/common/fetch'
|
|
import { API_URL, IS_PLATFORM } from 'lib/constants'
|
|
import { User } from 'types'
|
|
|
|
const sendEvent = (category: string, action: string, label: string, value?: string) => {
|
|
if (!IS_PLATFORM) return
|
|
|
|
return post(`${API_URL}/telemetry/event`, {
|
|
action: action,
|
|
category: category,
|
|
label: label,
|
|
value: value,
|
|
})
|
|
}
|
|
|
|
const sendIdentify = (user: User) => {
|
|
if (!IS_PLATFORM) return
|
|
|
|
return post(`${API_URL}/telemetry/identify`, { user })
|
|
}
|
|
|
|
export default {
|
|
sendEvent,
|
|
sendIdentify,
|
|
}
|