Created
July 22, 2023 20:26
-
-
Save knightbenax/211e550ed803c1dd0101731c55dc5a0b to your computer and use it in GitHub Desktop.
Example GraphQL implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthViewModel : BaseViewModel { | |
func loginUser(email: String, password: String, completion: @escaping (_ success : Bool, _ error : NSError?) -> Void){ | |
Network.shared.apollo.perform(mutation: BundulAPI.LoginUserMutation(loginInput: NameOfAPI.LoginInput(email: email, password: password))) { result in | |
switch result { | |
case .success(let graphQLResult): | |
print("Success! Result: \(graphQLResult)") | |
completion(true, nil) | |
case .failure(let error): | |
print("Failure! Error: \\(error)") | |
completion(false, error) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment