add doc about custom http header #829

This commit is contained in:
Baorong Li
2018-11-05 11:23:43 +08:00
parent 017af0ddfc
commit 6d552d22d9
4 changed files with 48 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
# 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);
});
```