diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/requests.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/requests.ts b/src/requests.ts index 6446baa..fa84c4a 100644 --- a/src/requests.ts +++ b/src/requests.ts @@ -2,9 +2,11 @@ import axios from 'axios'; const requests = axios.create({ baseURL: 'http://localhost:3030', - headers: { - 'Authorization': localStorage.getItem('token') - } +}); + +requests.interceptors.request.use(config => { + config.headers.Authorization = localStorage.getItem('token'); + return config; }); export const { get, post, put } = requests; |