diff --git a/KeKi/Data/Network/APIManager.swift b/KeKi/Data/Network/APIManager.swift index 189cd14..ef1ad06 100644 --- a/KeKi/Data/Network/APIManager.swift +++ b/KeKi/Data/Network/APIManager.swift @@ -288,8 +288,8 @@ extension APIManeger { parameter: T, completionHandler: @escaping (AuthResponse) -> Void) { - let accessToken = UserDefaults.standard.value(forKey: "accessToken") as! String - let header = APIManeger.shared.getHeaderByToken(accessToken: accessToken) +// let accessToken = UserDefaults.standard.value(forKey: "accessToken") as! String +// let header = APIManeger.shared.getHeaderByToken(accessToken: accessToken) guard let url = URL(string: DEV_BASE_URL + urlEndpointString) else { return } diff --git a/KeKi/Scenes/Login/LoginViewController.swift b/KeKi/Scenes/Login/LoginViewController.swift index c9d79d7..d7a0c27 100644 --- a/KeKi/Scenes/Login/LoginViewController.swift +++ b/KeKi/Scenes/Login/LoginViewController.swift @@ -212,6 +212,11 @@ extension LoginViewController { case Role.buyer.rawValue, Role.seller.rawValue: APIManeger.shared.setUserInfo(userInfo: result.result) + + let encoder = JSONEncoder() + if let encoded = try? encoder.encode(result.result) { + UserDefaults.standard.setValue(encoded, forKey: "userInfo") + } self?.showMain() default: