[Bug] Fix unable to set unsafe-headers

This commit is contained in:
Pranav Raj Sreepuram 2019-11-04 12:54:41 +05:30
parent c080f6c429
commit 7a2fb8eef1

View file

@ -18,7 +18,20 @@ export default axios => {
wootApi.defaults.baseURL = constants.apiURL;
// Add Auth Headers to requests if logged in
if (Auth.isLoggedIn()) {
Object.assign(wootApi.defaults.headers.common, Auth.getAuthData());
const {
'access-token': accessToken,
'token-type': tokenType,
client,
expiry,
uid,
} = Auth.getAuthData();
Object.assign(wootApi.defaults.headers.common, {
'access-token': accessToken,
'token-type': tokenType,
client,
expiry,
uid,
});
}
// Response parsing interceptor
wootApi.interceptors.response.use(