From f242b2c18b7f95f0d91258778b2631e28a221fcf Mon Sep 17 00:00:00 2001 From: Jan Romann Date: Fri, 22 Sep 2023 21:02:59 +0200 Subject: [PATCH] fixup! chore(binding-http): enable eslint/strict-boolean-expressions --- packages/binding-http/src/credential.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/binding-http/src/credential.ts b/packages/binding-http/src/credential.ts index 5388466a5..5d5a9500d 100644 --- a/packages/binding-http/src/credential.ts +++ b/packages/binding-http/src/credential.ts @@ -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; @@ -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;