title: Right way to refresh the token
body: <p>There is a function <code>getUser</code> in <code>RequestManager class</code> that called in my <code>VC</code>.</p>
  
  <pre><code>func getUser(onCompletion: @escaping (_ result: User?, error: String?) -&gt; Void) {
      Alamofire.request(Router.getUser).responseJSON { (response) in
          // here is the work with response
      }
  }
  </code></pre>
  
  <p>If this request returns <code>403</code> it means <code>access_token</code> is expired. I need to refresh token and repeat the request from my <code>VC</code>.</p>
  
  <p>Now the question.</p>
  
  <p>How to refresh token and repeat the request in the right way?</p>
  
  <p>To handle the error and refresh token in <code>MyViewController</code> or <code>getUser</code> method is not good idea because I have a lot of <code>VCs</code> and <code>request methods</code>.</p>
  
  <p>I need something like: <code>VC</code> calls the method and gets the <code>User</code> even if token is expired and <code>refreshToken</code> must <strong>not</strong> be in all request methods.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><code>refreshToken</code> method</p>
  
  <pre><code>func refreshToken(onCompletion: @escaping (_ result: Bool?) -&gt; Void) {
      Alamofire.request(Router.refreshToken).responseJSON { (response) in
          print(response)
          if response.response?.statusCode == 200 {
              guard let data = response.data else { return onCompletion(false) }
              let token = try? JSONDecoder().decode(Token.self, from: data)
              token?.setToken()
              onCompletion(true)
          } else {
              onCompletion(false)
          }
      }
  }
  </code></pre>