question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The interceptor did not take effect when I refreshed the page

See original GitHub issue

Summary

I wrote an interceptor in my Vue project,it works normally when the page is not refreshed.When I refresh the page,the request was sended, but the interceptor did not take effect,but at this time I switch the route, and it works again

Context

this is my interceptor ,i used vue-router in my Vue project, axios.interceptors.request.use( config => { console.log(1); return config; }, error => { console.log(2); return Promise.reject(error); } );

  • axios version: e.g.: v0.16.0
  • Environment: *e.g.: node v8.7.0, chrome 64, windows 7,vue 2.9.6

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
Pyrolisticalcommented, Apr 29, 2019

I’m running into the same issue, axios.interceptors.request.use just doesn’t get used in 0.18.x

I moved it from a global interceptor to an instance interceptor and that worked for me.

2reactions
chinesedfancommented, Mar 28, 2020

Closed due to lack of enough information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interceptor not executed when I refresh my page using ...
I am using JWT Authentication(Spring Boot Security) and on each click my interceptor is called to set the token before the request is...
Read more >
Top 10 ways to use Interceptors in Angular - Medium
My ten favorite ways to use the interceptor in Angular. With examples of error handling, profiling, caching and more this list will inspire...
Read more >
Angular Authentication part - 2 (Handling refresh token + Http ...
It will explain how to handle refresh token in angular application also redirecting to login page if the token is invalid or expired...
Read more >
Single-page application: Acquire a token to call an API
If no access token is found or the access token found has expired, it attempts to use its refresh token to get a...
Read more >
Angular 12 Refresh Token with Interceptor and JWT example
How to handle token expiration in Angular 12 - refresh Token before expiration using Http Interceptor 401 - silent refresh JWT token ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found