diff --git a/src/account.ts b/src/account.ts index 3a52879..cf93b6b 100644 --- a/src/account.ts +++ b/src/account.ts @@ -129,11 +129,14 @@ export default class AccountApi { } private buildOptions(): any { + const headers: any = {}; + if (this.jwtToken) { + headers.Authorization = `Bearer ${this.jwtToken}`; + } + return { baseURL: this.apiUrl, - headers: { - Authorization: `Bearer ${this.jwtToken}`, - }, + headers: headers, }; } }