mirror of
https://github.com/tooot-app/app
synced 2025-03-10 00:20:11 +01:00
parent
196f51bfca
commit
adb7a765b4
@ -32,7 +32,7 @@ const Logout: React.FC = () => {
|
|||||||
onPress: () => {
|
onPress: () => {
|
||||||
if (accountActive) {
|
if (accountActive) {
|
||||||
haptics('Light')
|
haptics('Light')
|
||||||
removeAccount(accountActive)
|
removeAccount(accountActive, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -264,14 +264,40 @@ export const setAccount = async (account: string) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const removeAccount = async (account: string) => {
|
export const removeAccount = async (account: string, warning: boolean = true) => {
|
||||||
displayMessage({
|
const temp = new MMKV({ id: account })
|
||||||
message: i18n.t('screens:localCorrupt.message'),
|
|
||||||
type: 'danger'
|
if (warning) {
|
||||||
})
|
const acct = temp.getString('auth.account.acct')
|
||||||
|
const domain = temp.getString('auth.account.domain')
|
||||||
|
displayMessage({
|
||||||
|
message: i18n.t('screens:localCorrupt.message'),
|
||||||
|
...(acct && domain && { description: `@${acct}@${domain}` }),
|
||||||
|
type: 'danger'
|
||||||
|
})
|
||||||
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
navigationRef.navigate('Screen-Tabs', { screen: 'Tab-Me' })
|
navigationRef.navigate('Screen-Tabs', { screen: 'Tab-Me' })
|
||||||
|
|
||||||
|
const revokeDetails = {
|
||||||
|
domain: temp.getString('auth.domain'),
|
||||||
|
client_id: temp.getString('auth.clientId'),
|
||||||
|
client_secret: temp.getString('auth.clientSecret'),
|
||||||
|
token: temp.getString('auth.token')
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
revokeDetails.domain &&
|
||||||
|
revokeDetails.client_id &&
|
||||||
|
revokeDetails.client_secret &&
|
||||||
|
revokeDetails.token
|
||||||
|
) {
|
||||||
|
const body = new FormData()
|
||||||
|
body.append('client_id', revokeDetails.client_id)
|
||||||
|
body.append('client_secret', revokeDetails.client_secret)
|
||||||
|
body.append('token', revokeDetails.token)
|
||||||
|
apiGeneral({ method: 'post', domain: revokeDetails.domain, url: '/oauth/revoke', body })
|
||||||
|
}
|
||||||
|
|
||||||
const currAccounts: NonNullable<StorageGlobal['accounts']> =
|
const currAccounts: NonNullable<StorageGlobal['accounts']> =
|
||||||
getGlobalStorage.object('accounts') || []
|
getGlobalStorage.object('accounts') || []
|
||||||
const nextAccounts: NonNullable<StorageGlobal['accounts']> = currAccounts.filter(
|
const nextAccounts: NonNullable<StorageGlobal['accounts']> = currAccounts.filter(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user