Only add authorization header if token exists

This commit is contained in:
Erik Larsson
2021-01-30 04:03:43 +01:00
parent 5ba0804189
commit 320708e171
4 changed files with 24 additions and 19 deletions
+1 -3
View File
@@ -60,9 +60,7 @@ export class RollbarClient implements RollbarApi {
const url = `${await this.discoveryApi.getBaseUrl('rollbar')}${path}`;
const idToken = await this.identityApi.getIdToken();
const response = await fetch(url, {
headers: {
authorization: `Bearer ${idToken}`,
},
headers: idToken ? { authorization: `Bearer ${idToken}` } : {},
});
if (!response.ok) {