You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

6 years ago
  1. //
  2. // FillRecoveryCodeViewModel.swift
  3. // GMERemittance
  4. //
  5. // Created by Sujal on 12/25/17.
  6. // Copyright © 2017 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class FillRecoveryCodeViewModel: FillCodeViewModel {
  10. /**
  11. Api request to reset code
  12. */
  13. func resetUser() {
  14. if !Reachability.isConnectedToNetwork() {
  15. self.internetConnection.value = false
  16. } else {
  17. RestApiMananger.sharedInstance.reAuthenticateUser(code: signupCode!, userId: UserDefaults.standard.object(forKey: "com.gmeremit.username") as! String) { result in
  18. switch result {
  19. case .success(_):
  20. self.authenticated.value = true
  21. case let .failure(errorJSON):
  22. self.setErrorMessage(message: errorJSON["message"].stringValue)
  23. self.authenticated.value = false
  24. case .updateAccessCode:
  25. return
  26. case .logOutUser():
  27. return
  28. case .timeOut:
  29. print("timeOut")
  30. }
  31. }
  32. }
  33. }
  34. }