Merge branch 'features/null_bearer2' into 'develop'
Fix authorization header when no access token See merge request gab/social/gab-social!58
This commit is contained in:
commit
c14fc2fa9d
@ -40,12 +40,13 @@ const notify = options =>
|
|||||||
const fetchFromApi = (path, method, accessToken) => {
|
const fetchFromApi = (path, method, accessToken) => {
|
||||||
const url = (new URL(path, self.location)).href;
|
const url = (new URL(path, self.location)).href;
|
||||||
|
|
||||||
|
let headers = {
|
||||||
|
'Authorization': `Bearer ${accessToken}`,
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
}
|
||||||
|
if (!accessToken) { delete headers['Authorization'] }
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
headers: {
|
headers: headers,
|
||||||
'Authorization': `Bearer ${accessToken}`,
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
|
|
||||||
method: method,
|
method: method,
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
Loading…
Reference in New Issue
Block a user