How can I send request again in response interceptor?

前端 未结 4 1962
花落未央
花落未央 2021-01-30 21:59

I\'ve made an interceptor in my application that detects session loss (server sends an HTTP 419). In this case, I need to request a new session from the server, and then I would

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 22:17

    You're on the right path, you basically store the request in a queue and retry it after you've re-established the session.

    Check out this popular module: angular http auth (https://github.com/witoldsz/angular-http-auth). In this module, they intercept 401 responses but you can model your solution off of this approach.

提交回复
热议问题