Merge branch 'fix_null_bearer' into 'develop'
Avoid redundant Doorkeeper queries when not signed in See merge request gab/social/gab-social!57
This commit is contained in:
commit
22c3fa995d
|
@ -25,16 +25,20 @@ function setCSRFHeader() {
|
||||||
|
|
||||||
ready(setCSRFHeader);
|
ready(setCSRFHeader);
|
||||||
|
|
||||||
export default getState => axios.create({
|
export default getState => {
|
||||||
headers: Object.assign(csrfHeader, getState ? {
|
const authToken = getState ? getState().getIn(['meta', 'access_token'], '') : null;
|
||||||
'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`,
|
|
||||||
} : {}),
|
|
||||||
|
|
||||||
transformResponse: [function (data) {
|
return axios.create({
|
||||||
try {
|
headers: Object.assign(csrfHeader, authToken ? {
|
||||||
return JSON.parse(data);
|
'Authorization': `Bearer ${authToken}}`,
|
||||||
} catch (Exception) {
|
} : {}),
|
||||||
return data;
|
|
||||||
}
|
transformResponse: [function (data) {
|
||||||
}],
|
try {
|
||||||
});
|
return JSON.parse(data);
|
||||||
|
} catch (Exception) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue