Skip to content

Commit

Permalink
redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
SunYiwen committed Mar 29, 2020
1 parent c4b7221 commit d4304da
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 38 deletions.
71 changes: 34 additions & 37 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion front-end/http.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from 'axios'
import qs from 'qs'

axios.defaults.timeout = 5000 // 响应时间
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'// 配置请求头
axios.defaults.baseURL = 'http://localhost:3000'// 配置接口地址
Expand All @@ -26,6 +25,11 @@ axios.interceptors.response.use((res) => {
}
return res
}, (error) => {
console.log('status:' + typeof error.response)
if (error.response.status === 302) {
window.location = '/login'
console.log('重定向')
}
window.console.log('网络异常')
return Promise.reject(error)
})
Expand Down

0 comments on commit d4304da

Please sign in to comment.