From d18e3a9da50d42fe82b2bfa05e147f877dab2466 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 13 Mar 2024 18:12:18 -0400 Subject: [PATCH] fix: use URL.URL --- src/account.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/account.ts b/src/account.ts index e137068..b463032 100644 --- a/src/account.ts +++ b/src/account.ts @@ -24,13 +24,14 @@ import { postApiAuthPasswordResetConfirm, } from "./account/generated/index.js"; import { AxiosResponse } from "axios"; +import * as URL from 'url'; export default class AccountApi { private apiUrl: string; private jwtToken?: string; constructor(apiUrl: string) { - let apiUrlParsed = new URL(apiUrl); + let apiUrlParsed = new URL.URL(apiUrl); apiUrlParsed.hostname = `account.${apiUrlParsed.hostname}`; this.apiUrl = apiUrlParsed.toString(); @@ -50,7 +51,7 @@ export default class AccountApi { ret = this.checkSuccessVal(ret); if (ret) { - this.jwtToken = (ret as LoginResponse).token; + this._jwtToken = (ret as LoginResponse).token; return true; } @@ -58,7 +59,7 @@ export default class AccountApi { } public async logout(): Promise { - this.jwtToken = undefined; + this._jwtToken = undefined; return true; } @@ -192,8 +193,8 @@ export default class AccountApi { private buildOptions(): any { const headers: any = {}; - if (this.jwtToken) { - headers.Authorization = `Bearer ${this.jwtToken}`; + if (this._jwtToken) { + headers.Authorization = `Bearer ${this._jwtToken}`; } return {