diff --git a/Modules/Sources/Profile/UI/Views/ProfileView.swift b/Modules/Sources/Profile/UI/Views/ProfileView.swift index 9e3b7fd..d72fe28 100644 --- a/Modules/Sources/Profile/UI/Views/ProfileView.swift +++ b/Modules/Sources/Profile/UI/Views/ProfileView.swift @@ -7,6 +7,7 @@ // import DataModels +import KeychainStorage import SwiftUI public struct ProfileView: View { @@ -15,6 +16,10 @@ public struct ProfileView: View { @Environment(\.dismiss) private var dismiss + // MARK: Storages + + @KeychainStorage(key: .KeychainStorage.account) var account: Account? + // MARK: Properties private let user: User? @@ -84,7 +89,7 @@ public struct ProfileView: View { Section { Button { - logout() + Task { await logUserOut() } } label: { Text( "profile.button.log_out.text", @@ -107,6 +112,16 @@ public struct ProfileView: View { } +// MARK: - Helpers + +private extension ProfileView { + func logUserOut() async { + account = nil + + logout() + } +} + // MARK: - Images+Constants private extension Image {