[🐴] delete chat service account on account delete (#4056)

* delete chat service account on account delete

* Add proxy header

---------

Co-authored-by: Eric Bailey <git@esb.lol>
zio/stable
Samuel Newman 2024-05-17 20:53:51 +01:00 committed by GitHub
parent f42f7fa035
commit cef243bcf4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {useModalControls} from '#/state/modals'
import {DM_SERVICE_HEADERS} from '#/state/queries/messages/const'
import {useAgent, useSession, useSessionApi} from '#/state/session'
import {usePalette} from 'lib/hooks/usePalette'
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
@ -61,6 +62,16 @@ export function Component({}: {}) {
const token = confirmCode.replace(/\s/g, '')
try {
// inform chat service of intent to delete account
const {success} = await getAgent().api.chat.bsky.actor.deleteAccount(
undefined,
{
headers: DM_SERVICE_HEADERS,
},
)
if (!success) {
throw new Error('Failed to inform chat service of account deletion')
}
await getAgent().com.atproto.server.deleteAccount({
did: currentAccount.did,
password,