aboutsummaryrefslogtreecommitdiff
path: root/src/requests.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/requests.ts')
-rw-r--r--src/requests.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/requests.ts b/src/requests.ts
index fa84c4a..4cfd37b 100644
--- a/src/requests.ts
+++ b/src/requests.ts
@@ -1,12 +1,13 @@
import axios from 'axios';
+import _ from 'lodash';
const requests = axios.create({
- baseURL: 'http://localhost:3030',
+ baseURL: 'http://localhost:3030'
});
requests.interceptors.request.use(config => {
- config.headers.Authorization = localStorage.getItem('token');
- return config;
+ const token = localStorage.getItem('token');
+ return _.set(config, 'headers.Authorization', token);
});
export const { get, post, put } = requests;