Created
          December 19, 2017 14:19 
        
      - 
      
 - 
        
Save ivangodfather/a295078a41e3fb75531203ea55ccae14 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class MyMoyaProvider<Target>: MoyaProvider<Target> where Target: Moya.TargetType { | |
| override init(endpointClosure: @escaping EndpointClosure = MoyaProvider.defaultEndpointMapping, | |
| requestClosure: @escaping RequestClosure = MoyaProvider.defaultRequestMapping, | |
| stubClosure: @escaping StubClosure = MoyaProvider.neverStub, | |
| callbackQueue: DispatchQueue? = nil, | |
| manager: Manager = MoyaProvider<Target>.defaultAlamofireManager(), | |
| plugins: [PluginType] = [], | |
| trackInflights: Bool = false) { | |
| super.init(endpointClosure: endpointClosure, | |
| requestClosure: requestClosure, | |
| stubClosure: stubClosure, | |
| callbackQueue: callbackQueue, | |
| manager: manager, | |
| plugins: plugins, | |
| trackInflights: trackInflights) | |
| } | |
| public override func request(_ target: Target, callbackQueue: DispatchQueue?, progress: ProgressBlock?, completion: @escaping Completion) -> Cancellable { | |
| return super.request(target, callbackQueue: callbackQueue, progress: progress, completion: completion) | |
| //Basically here i would like to be able to flatMap the Response and if statusCode == 401 perform a refresh token, or maybe using retryWhen | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment