Change Result/Failure logic to match new AccountError cases

This commit is contained in:
Angelo Stavrow 2020-08-17 13:31:20 -04:00
parent a56da3c07b
commit 3384a972b0
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -25,14 +25,16 @@ class AccountModel: ObservableObject {
if server != validServer {
result = .failure(.serverNotFound)
} else if username == validCredentials["username"] && password == validCredentials["password"] {
} else if username != validCredentials["username"] {
result = .failure(.usernameNotFound)
} else if password != validCredentials["password"] {
result = .failure(.invalidPassword)
} else {
self.id = UUID()
self.username = username
self.password = password
self.server = server
result = .success(self.id!)
} else {
result = .failure(.invalidCredentials)
}
#if DEBUG