From a7acb3bd23de0f104e35ccaba60e5d6578e89cbf Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sat, 22 May 2021 13:54:30 +0100 Subject: [PATCH] Run linter. --- src/pages/Secrets/TOTP/TOTPView.tsx | 61 +++++++++++++++-------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/pages/Secrets/TOTP/TOTPView.tsx b/src/pages/Secrets/TOTP/TOTPView.tsx index 1d6581b..f4b2f87 100644 --- a/src/pages/Secrets/TOTP/TOTPView.tsx +++ b/src/pages/Secrets/TOTP/TOTPView.tsx @@ -1,3 +1,4 @@ +import { Component, JSX, render } from "preact"; import { CopyableInputBox } from "../../../elements/ReactCopyableInputBox"; import { DoesNotExistError } from "../../../types/internalErrors"; import { Page } from "../../../types/Page"; @@ -6,11 +7,11 @@ import { getTOTPCode } from "../../../api/totp/getTOTPCode"; import { getTOTPKeys } from "../../../api/totp/getTOTPKeys"; import { setErrorText } from "../../../pageUtils"; import i18next from "i18next"; -import { render, JSX, Component } from "preact"; - - -export class RefreshingTOTPGridItem extends Component<{ baseMount: string; totpKey: string }, { totpValue: string }> { +export class RefreshingTOTPGridItem extends Component< + { baseMount: string; totpKey: string }, + { totpValue: string } +> { constructor() { super(); this.state = { totpValue: "" }; @@ -18,9 +19,9 @@ export class RefreshingTOTPGridItem extends Component<{ baseMount: string; totpK timer: unknown; updateTOTPCode(): void { - getTOTPCode(this.props.baseMount, this.props.totpKey).then((code) => { + void getTOTPCode(this.props.baseMount, this.props.totpKey).then((code) => { this.setState({ totpValue: code }); - }) + }); } componentDidMount(): void { @@ -53,44 +54,44 @@ export class TOTPViewPage extends Page { } async render(): Promise { - render(( + render(


- {await (async () => { - try { - const elem = await Promise.all(Array.from(await getTOTPKeys(this.state.baseMount)).map(async (key) => - - )) - return elem; - } catch (e: unknown) { - const error = e as Error; - if (error == DoesNotExistError) { - return

{i18next.t("totp_view_empty")}

- } else { - setErrorText(error.message); + { + await (async () => { + try { + const elem = await Promise.all( + Array.from(await getTOTPKeys(this.state.baseMount)).map(async (key) => ( + + )), + ); + return elem; + } catch (e: unknown) { + const error = e as Error; + if (error == DoesNotExistError) { + return

{i18next.t("totp_view_empty")}

; + } else { + setErrorText(error.message); + } } - } - })()} + })() + }
-
- ), this.router.pageContentElement) - + , + this.router.pageContentElement, + ); } - - async getPageTitle(): Promise { return await SecretTitleElement(this.router); }