Commit 57bbbc9f7a181d84fdf3d77f378a85cc100bc322
1 parent
fe98e57f
去除部分调试日志以及恢复代码
Showing
2 changed files
with
11 additions
and
13 deletions
web_src/src/App.vue
| ... | ... | @@ -21,7 +21,6 @@ export default { |
| 21 | 21 | created() { |
| 22 | 22 | if(!this.$cookies.get("session")){ |
| 23 | 23 | //如果没有登录状态则跳转到登录页 |
| 24 | - console.log("33333333") | |
| 25 | 24 | this.$router.push('/login'); |
| 26 | 25 | } |
| 27 | 26 | }, |
| ... | ... | @@ -43,7 +42,6 @@ export default { |
| 43 | 42 | //cookie操作方法在源码里有或者参考网上的即可 |
| 44 | 43 | if(!this.$cookies.get("session")){ |
| 45 | 44 | //如果没有登录状态则跳转到登录页 |
| 46 | - console.log("222222222") | |
| 47 | 45 | this.$router.push('/login'); |
| 48 | 46 | } |
| 49 | 47 | }, | ... | ... |
web_src/src/main.js
| ... | ... | @@ -41,17 +41,17 @@ Vue.prototype.$notify = Notification; |
| 41 | 41 | axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : ""; |
| 42 | 42 | |
| 43 | 43 | // api 返回401自动回登陆页面 |
| 44 | -// axios.interceptors.response.use(function (response) { | |
| 45 | -// // 对响应数据做点什么 | |
| 46 | -// return response; | |
| 47 | -// }, function (error) { | |
| 48 | -// // 对响应错误做点什么 | |
| 49 | -// if (error.response.status === 401) { | |
| 50 | -// console.log((1111)) | |
| 51 | -// router.push('/login'); | |
| 52 | -// } | |
| 53 | -// return Promise.reject(error); | |
| 54 | -// }); | |
| 44 | +axios.interceptors.response.use(function (response) { | |
| 45 | + // 对响应数据做点什么 | |
| 46 | + return response; | |
| 47 | +}, function (error) { | |
| 48 | + // 对响应错误做点什么 | |
| 49 | + if (error.response.status === 401) { | |
| 50 | + console.log((1111)) | |
| 51 | + router.push('/login'); | |
| 52 | + } | |
| 53 | + return Promise.reject(error); | |
| 54 | +}); | |
| 55 | 55 | |
| 56 | 56 | Vue.prototype.$cookies.config(60*30); |
| 57 | 57 | ... | ... |