WIP
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
import Foundation
|
||||
|
||||
class UserStore: ObservableObject {
|
||||
static let userNameKeychainValue = "username"
|
||||
static let passwordKeychainValue = "password"
|
||||
|
||||
static let userDefaultsRegisteredUserKey = "registeredUserKey"
|
||||
static let shared = UserStore()
|
||||
|
||||
@@ -34,6 +37,13 @@ class UserStore: ObservableObject {
|
||||
LoginFetchable(postData: postData).fetch(completion: { result in
|
||||
switch result {
|
||||
case .success(let model):
|
||||
if let email = postData["email"] as? String,
|
||||
let password = postData["password"] as? String,
|
||||
let data = password.data(using: .utf8) {
|
||||
try? KeychainInterface.save(password: data,
|
||||
account: email)
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.registeredUser = model
|
||||
let data = try! JSONEncoder().encode(model)
|
||||
|
||||
Reference in New Issue
Block a user