The Axios request handles the asynchronous execution of the callback function in the interceptor, resulting in the failure to get the token refresh
https.interceptors.request.use(config => {
if (Determine if the token is expired) {
let promisefresh = new Promise(function (resolve, reject) {
WebViewJavascriptBridge.callHandler(
"getUserInfo",
{
key: "111"
},
function (responseData) {
removeItem("FToken");
setItem("FToken", responseData);
config.headers["FToken"] = getItem("FToken");
config.headers["FAppType"] = "M";
resolve(config);
}
);
});
return promisefresh;
} else {
config.headers["FToken"] = getItem("FToken");
config.headers["FAppType"] = "M";
return config;
}
}, function (error) {
return Promise.reject(error);
});
axios.interceptors.response.use();
Read More:
- [Vue warn]: Error in callback for watcher “value“ (How to Solve)
- Vue2.0: How to Use vue3 api to encapsulate Axios
- [Solved] Uncaught ReferenceError: axios is not defined
- [Solved] vuecli2+axios Error: NotSameOriginAfterDefaultedToSameOriginByCoep
- [Vue warn]: Error in callback for watcher “fileList”: “TypeError: Cannot create property ‘uid’ on string
- [Solved] Error in callback for watcher “value“: “TypeError: Cannot read property ‘level‘ of null“
- How to Solve Uncaught (in promise) Error (Two Solutions)
- [Solved] vue watch Error: Error in callback for watcher “xxx“: “TypeError: Cannot read properties of undefined …
- Asynchronous loading method of Baidu map
- [Solved] echarts Error: Error in callback for watcher “chartSource“: “Error: Initialize failed: invalid dom.“
- Element El dialog close callback error [How to Solve]
- Trigger http request when tab page is closed in angular2+ project
- Difference between contenttype and datatype in Ajax request of jquery
- Interface request error 504 gateway time out [How to Solve]
- How to solve Uncaught (in promise) error in VUE?
- Error:Request failed with status code 401 [How to Solve]
- [Vue warn]: Error in v-on handler: “TypeError: Object(…) is not a function“
- Solve the problem of repeatedly clicking the same route console in Vue to report an error
- [Solved] Failed to load plugin ‘vue‘ declared in ‘.eslintrc.js‘: createRequire is not a function
- request.js?b775:101 Uncaught (in promise) Error: Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Long’;