From 08cf7187fc4f449c506efb68ff8c1b842ce4d045 Mon Sep 17 00:00:00 2001 From: ingalls Date: Tue, 3 Sep 2024 09:33:30 -0600 Subject: [PATCH] Give TAKAuth.init full API object --- api/lib/tak-api.ts | 2 +- api/lib/tak-auth.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/lib/tak-api.ts b/api/lib/tak-api.ts index 26c323c70..e6cc0f379 100644 --- a/api/lib/tak-api.ts +++ b/api/lib/tak-api.ts @@ -50,7 +50,7 @@ export default class TAKAPI { static async init(url: URL, auth: auth.APIAuth): Promise { const api = new TAKAPI(url, auth); - await api.auth.init(api.url); + await api.auth.init(api); return api; } diff --git a/api/lib/tak-auth.ts b/api/lib/tak-auth.ts index f50b92f15..fb51e74f1 100644 --- a/api/lib/tak-auth.ts +++ b/api/lib/tak-auth.ts @@ -7,7 +7,7 @@ import TAKAPI from './tak-api.js'; import stream2buffer from './stream.js'; export class APIAuth { - async init(base: URL) { // eslint-disable-line @typescript-eslint/no-unused-vars + async init(api: TAKAPI) { // eslint-disable-line @typescript-eslint/no-unused-vars } @@ -27,8 +27,8 @@ export class APIAuthPassword extends APIAuth { this.password = password; } - async init(base: URL) { - const url = new URL('/oauth/token', base); + async init(api: TAKAPI) { + const url = new URL('/oauth/token', api.url); url.searchParams.append('grant_type', 'password'); url.searchParams.append('username', this.username); url.searchParams.append('password', this.password);