Files
suixinkan_uikit/suixinkan/Features/Auth/AuthSessionHelper.swift

27 lines
819 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AuthSessionHelper.swift
// suixinkan
//
import Foundation
/// Token 广
enum AuthSessionHelper {
/// Token SceneDelegate
static func completeLogin(
with response: V9AuthResponse,
username: String,
privacyAgreementAccepted: Bool
) {
let token = response.token.trimmingCharacters(in: .whitespacesAndNewlines)
guard !token.isEmpty else { return }
AppStore.shared.saveToken(token)
AppStore.shared.lastLoginUsername = username
AppStore.shared.privacyAgreementAccepted = privacyAgreementAccepted
NotificationCenter.default.post(name: NotificationName.userDidLogin, object: nil)
}
}