1
0
mirror of https://github.com/tooot-app/app synced 2025-04-25 15:38:42 +02:00
This commit is contained in:
xmflsct 2023-02-07 22:19:39 +01:00
parent 0b3d206190
commit 8775a0cb25

View File

@ -244,6 +244,12 @@ export const setAccount = async (account: string) => {
return return
} }
log('log', 'setAccount', `binding storage of ${account}`)
storage.account = temp
setGlobalStorage('account.active', account)
await queryClient.resetQueries()
queryClient.clear()
await apiGeneral<Mastodon.Account>({ await apiGeneral<Mastodon.Account>({
method: 'get', method: 'get',
domain, domain,
@ -254,15 +260,10 @@ export const setAccount = async (account: string) => {
}) })
.then(res => res.body) .then(res => res.body)
.then(async a => { .then(async a => {
temp.set('auth.account.acct', a.acct) storage.account?.set('auth.account.acct', a.acct)
temp.set('auth.account.avatar_static', a.avatar_static) storage.account?.set('auth.account.avatar_static', a.avatar_static)
log('log', 'setAccount', `binding storage of ${account}`) log('log', 'setAccount', 'update details')
await queryClient.resetQueries()
queryClient.clear()
storage.account = temp
setGlobalStorage('account.active', account)
}) })
.catch(async error => { .catch(async error => {
if (error?.status && error.status == 401) { if (error?.status && error.status == 401) {
@ -302,7 +303,7 @@ export const removeAccount = async (account: string, warning: boolean = true) =>
apiGeneral({ apiGeneral({
method: 'post', method: 'post',
domain: revokeDetails.domain, domain: revokeDetails.domain,
url: '/oauth/revoke', url: 'oauth/revoke',
body: revokeDetails body: revokeDetails
}) })
} }