Guest User

Untitled

a guest
May 27th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. let input = Storefront.CustomerUpdateInput.create(
  2. firstName: .value("John")
  3. )
  4.  
  5. let mutation = Storefront.buildMutation { $0
  6. .customerUpdate(customerAccessToken: "<customer access token>", customer: input) { $0
  7. .customer { $0
  8. .firstName()
  9. }
  10. .userErrors { $0
  11. .field()
  12. .message()
  13. }
  14. }
  15. }
  16.  
  17. let task = client.mutateGraphWith(mutation) { response, error in
  18. if let mutation = response?.customerUpdate, let customer = mutation.customer {
  19. print("[INFO] Update Customer success: \(customer)")
  20. } else {
  21. print("[ERROR] Update Customer failed: \(error)")
  22. }
  23. }
  24. task.resume()
Add Comment
Please, Sign In to add comment