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,9 +25,12 @@ function setCSRFHeader() {
|
|||
|
||||
ready(setCSRFHeader);
|
||||
|
||||
export default getState => axios.create({
|
||||
headers: Object.assign(csrfHeader, getState ? {
|
||||
'Authorization': `Bearer ${getState().getIn(['meta', 'access_token'], '')}`,
|
||||
export default getState => {
|
||||
const authToken = getState ? getState().getIn(['meta', 'access_token'], '') : null;
|
||||
|
||||
return axios.create({
|
||||
headers: Object.assign(csrfHeader, authToken ? {
|
||||
'Authorization': `Bearer ${authToken}}`,
|
||||
} : {}),
|
||||
|
||||
transformResponse: [function (data) {
|
||||
|
@ -37,4 +40,5 @@ export default getState => axios.create({
|
|||
return data;
|
||||
}
|
||||
}],
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue