Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let input = Storefront.CustomerAccessTokenCreateInput.create(
- email: "johndoe@gmail.com",
- password: "12345"
- )
- let mutation = Storefront.buildMutation { $0
- .customerAccessTokenCreate(input: input) { $0
- .customerAccessToken { $0
- // [SUCCESS] Properties to get from response
- .accessToken()
- .expiresAt()
- }
- .userErrors { $0
- // [ERROR] Properties to get from response
- .field()
- .message()
- }
- }
- }
- let task = client.mutateGraphWith(mutation) { response, error in
- if let mutation = response?.customerAccessTokenCreate, let accessToken = mutation.customerAccessToken {
- print("[INFO] Login success: \(accessToken)")
- } else {
- print("[ERROR] Login failed: \(error)")
- }
- }
- task.resume()
Add Comment
Please, Sign In to add comment