Skip to content

Commit c126645

Browse files
committed
first commit
1 parent 721d9f2 commit c126645

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/popup/axios.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ let isRefreshing = false
1616
let requests = []
1717
// const baseURL = 'http://py.wam7.cc'
1818
// axios.defaults.baseURL = baseURL
19-
if (localStorage.getItem('access_token')) {
20-
axios.defaults.headers.Authorization = 'Bearer ' + localStorage.getItem('access_token')
21-
}
2219
axios.interceptors.request.use(
2320
config => {
21+
if (localStorage.getItem('access_token')) { //判断token是否存在
22+
config.headers.Authorization = 'Bearer ' + localStorage.getItem('access_token')
23+
}
2424
// alert('拦截到请求' + JSON.stringify(config.headers))
2525
return config
2626
}, error => {

0 commit comments

Comments
 (0)