vue下axios拦截器token刷新机制的实例代码

2020-06-16 06:40:40易采站长站整理

localStorage.setItem("token", JSON.stringify(token));

}).catch(function(err) {
console.log(err);
});

//退出清空token
this.http({
method: "get",
url: "/xxxxx/logout",
data: {}
}).then(function(res) {
localStorage.removeItem("token");
}).catch(function(err) {
console.log(err);
});

总结

以上所述是小编给大家介绍的vue下axios拦截器token刷新机制的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!