Files
Compass/web/lib/util/delete.ts
2026-02-22 18:06:38 +01:00

16 lines
513 B
TypeScript

import posthog from 'posthog-js'
import {clearUserCookie} from 'web/components/auth-context'
import {api} from 'web/lib/api'
import {firebaseLogout} from 'web/lib/firebase/users'
import {track} from 'web/lib/service/analytics'
export async function deleteAccount(reasons?: {reasonCategory?: string | null; reasonDetails?: string}) {
track('delete account')
await api('me/delete', reasons || {})
await firebaseLogout()
clearUserCookie()
localStorage.clear()
sessionStorage.clear()
posthog.reset()
}