支持接口鉴权,支持修改密码,
This commit is contained in:
@@ -40,6 +40,18 @@ Vue.prototype.$notify = Notification;
|
||||
|
||||
axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : "";
|
||||
|
||||
// api 返回401自动回登陆页面
|
||||
axios.interceptors.response.use(function (response) {
|
||||
// 对响应数据做点什么
|
||||
return response;
|
||||
}, function (error) {
|
||||
// 对响应错误做点什么
|
||||
if (error.response.status === 401) {
|
||||
router.push('/login');
|
||||
}
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
Vue.prototype.$cookies.config(60*30);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user