First of all, let me tell you something.
After login successfully return token and then take token to continue the following request,
The strange thing is that the current page works, and the token disappears after the refresh and jump.
I checked the Axios document and found myself in the hole.
I set the global default token, but I'm going to customize the instance below but I don't have token set,
So here's the situation, and here's the code I changed.
The custom Axios response Interceptor instance is an Axios instance//HTTP request Interceptor Instance.interceptors.request.use ( config + = cons Ole.dir (Localstorage.getitem (' token ')) if (Localstorage.getitem (' token ')! = null) {//Determine if token exists, if present, Each HTTP header is prefixed with token config.headers.Authorization = Localstorage.getitem (' token '); } return config; }, err = { return promise.reject (ERR); });
Global Axios default values and custom instance defaults