Fix authorization header when no access token
This commit is contained in:
parent
31922ea58b
commit
ae036995bf
|
@ -40,12 +40,13 @@ const notify = options =>
|
|||
const fetchFromApi = (path, method, accessToken) => {
|
||||
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, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
||||
headers: headers,
|
||||
method: method,
|
||||
credentials: 'include',
|
||||
}).then(res => {
|
||||
|
|
Loading…
Reference in New Issue