嗨有没有办法可以退出嵌套的闭包,这里是代码
context.Users
当我想要返回端点时,我得到这个“LokaliiAuthorizationAPI无法转换为()”错误
let authorizationEndpointsClosure = { (target: LokaliiAuthorizationAPI) -> Endpoint<LokaliiAuthorizationAPI> in
let url = target.baseURL.URLByAppendingPathComponent(target.path).absoluteString
let endpoint = Endpoint<LokaliiAuthorizationAPI>(URL: url!, sampleResponse: .Success(200, {target.sampleData}), method: target.method, parameters: target.parameters)
switch target {
case .TokenRequest,
return endpoint
default:
MNAuthClient.sharedClient.retriveAccessToken() { result in
switch result {
case .Success(let succ):
let token = succ.value
return endpoint.endpointByAddingHTTPHeaderFields(["Authorization": "Bearer \(token.accessToken)"])
case .Failure(let error):
return endpoint
println("Error for refresh token : \(error.value)")
}
}
}
}