Skip to content

Commit

Permalink
fixup! chore(binding-http): enable eslint/strict-boolean-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Sep 22, 2023
1 parent e752fa7 commit f242b2c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/binding-http/src/credential.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ export interface TuyaCustomBearerCredentialConfiguration {
secret: string;
}

interface TokenResponse {
success?: boolean;
result?: {
// eslint-disable-next-line camelcase
access_token?: string;
// eslint-disable-next-line camelcase
refresh_token?: string;
// eslint-disable-next-line camelcase
expire_time?: number;
};
}

export class TuyaCustomBearer extends Credential {
protected key: string;
protected secret: string;
Expand Down Expand Up @@ -201,17 +213,7 @@ export class TuyaCustomBearer extends Credential {
if (refresh) {
url = `${this.baseUri}/token/${this.refreshToken}`;
}
const data: {
success?: boolean;
result?: {
// eslint-disable-next-line camelcase
access_token?: string;
// eslint-disable-next-line camelcase
refresh_token?: string;
// eslint-disable-next-line camelcase
expire_time?: number;
};
} = await (await fetch(url, request)).json();
const data: TokenResponse = await (await fetch(url, request)).json();
if (data.success === true) {
this.token = data.result?.access_token;
this.refreshToken = data.result?.refresh_token;
Expand Down

0 comments on commit f242b2c

Please sign in to comment.