mirror of
https://github.com/zuiidea/antd-admin.git
synced 2024-04-21 12:32:14 +00:00
22 lines
461 B
Markdown
22 lines
461 B
Markdown
# HTTP request
|
|
|
|
this project use axios for http service, file located in src/utils/request.js
|
|
|
|
## Custom Header
|
|
|
|
As for privilege access or modify cookie, you could add header param by yourself
|
|
|
|
```
|
|
axios.defaults.headers.common['Authorization'] = 'token'
|
|
```
|
|
|
|
Or
|
|
|
|
```
|
|
axios.interceptors.request.use(function (config) {
|
|
config.headers.token = window.localStorage.getItem('token');
|
|
return config;
|
|
}, function (error) {
|
|
return Promise.reject(error);
|
|
});
|
|
``` |