Fix logout

This commit is contained in:
Thomas Ricouard 2023-02-04 21:54:41 +01:00
parent f73bac9ae7
commit f55cadfbdd
2 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import Env
import Models
import SwiftUI
import Timeline
import Network
struct AccountSettingsView: View {
@Environment(\.dismiss) private var dismiss
@ -67,6 +68,8 @@ struct AccountSettingsView: View {
Button(role: .destructive) {
if let token = appAccount.oauthToken {
Task {
let client = Client(server: appAccount.server, oauthToken: token)
await TimelineCache.shared.clearCache(for: client)
if let sub = pushNotifications.subscriptions.first(where: { $0.account.token == token }) {
await sub.deleteSubscription()
}

View File

@ -78,6 +78,8 @@ struct SettingsTabs: View {
let sub = pushNotifications.subscriptions.first(where: { $0.account.token == token })
{
Task {
let client = Client(server: account.server, oauthToken: token)
await TimelineCache.shared.clearCache(for: client)
await sub.deleteSubscription()
appAccountsManager.delete(account: account)
}