Skip to content

Commit

Permalink
Give TAKAuth.init full API object
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Sep 3, 2024
1 parent 2c6e9d1 commit 08cf718
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/lib/tak-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class TAKAPI {
static async init(url: URL, auth: auth.APIAuth): Promise<TAKAPI> {
const api = new TAKAPI(url, auth);

await api.auth.init(api.url);
await api.auth.init(api);

return api;
}
Expand Down
6 changes: 3 additions & 3 deletions api/lib/tak-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

}

Expand All @@ -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);
Expand Down

0 comments on commit 08cf718

Please sign in to comment.