From daf38957a413f633c3a2985b55a58f037977d16b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 13 Mar 2024 12:56:01 -0400 Subject: [PATCH] fix: if jwt is not set, don't send it --- src/account.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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, }; } }