Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LoginOp<T: UserModelProtocol>: AtlasOperation<T> {
- public init(email: String, password: String) {
- super.init()
- self.request = Request(method: .post, endpoint: type.endpoint)
- self.tokenRefreshAllowed = false
- self.request?.headers = [Constants.Headers.Authorization.rawValue : nil] // remove auth header
- self.request?.body = RequestBody.json([“email”: email, “pwd”: password])
- self.request?.cachePolicy = URLRequest.CachePolicy.reloadIgnoringCacheData
- self.onGenerateOutputModel = { json in
- let newUser = T(json[“data”])
- return newUser
- }
- }
- }
Add Comment
Please, Sign In to add comment