Guest User

Untitled

a guest
Dec 1st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public class LoginOp<T: UserModelProtocol>: AtlasOperation<T> {
  2. public init(email: String, password: String) {
  3. super.init()
  4. self.request = Request(method: .post, endpoint: type.endpoint)
  5. self.tokenRefreshAllowed = false
  6. self.request?.headers = [Constants.Headers.Authorization.rawValue : nil] // remove auth header
  7. self.request?.body = RequestBody.json([“email”: email, “pwd”: password])
  8. self.request?.cachePolicy = URLRequest.CachePolicy.reloadIgnoringCacheData
  9. self.onGenerateOutputModel = { json in
  10. let newUser = T(json[“data”])
  11. return newUser
  12. }
  13. }
  14. }
Add Comment
Please, Sign In to add comment