get authToken and set Authorization header in axios request interceptor
This commit is contained in:
1 parent
d3fa71f114
commit
1410c23c99
1 file changed
+4
-1
@@ -28,9 +28,12 @@ class NetworkService {
|
|||||||
(config) => {
|
(config) => {
|
||||||
const currentLanguage = i18next.language || "en";
|
const currentLanguage = i18next.language || "en";
|
||||||
|
|
||||||
|
const { authToken } = store.getState().auth;
|
||||||
|
|
||||||
config.headers = {
|
config.headers = {
|
||||||
...config.headers,
|
Authorization: `Bearer ${authToken}`,
|
||||||
"Accept-Language": currentLanguage,
|
"Accept-Language": currentLanguage,
|
||||||
|
...config.headers,
|
||||||
};
|
};
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
Reference in new issue
Block a user