From 331d8c9e818043392fbedcbecd8f36bf4b3af530 Mon Sep 17 00:00:00 2001 From: Kitteh Date: Sat, 22 May 2021 13:40:12 +0100 Subject: [PATCH] Make TOTPView load data right away. --- src/pages/Secrets/TOTP/TOTPView.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/Secrets/TOTP/TOTPView.tsx b/src/pages/Secrets/TOTP/TOTPView.tsx index 6f06b1b..1d6581b 100644 --- a/src/pages/Secrets/TOTP/TOTPView.tsx +++ b/src/pages/Secrets/TOTP/TOTPView.tsx @@ -17,12 +17,16 @@ export class RefreshingTOTPGridItem extends Component<{ baseMount: string; totpK } timer: unknown; + updateTOTPCode(): void { + getTOTPCode(this.props.baseMount, this.props.totpKey).then((code) => { + this.setState({ totpValue: code }); + }) + } + componentDidMount(): void { + this.updateTOTPCode(); this.timer = setInterval(() => { - getTOTPCode(this.props.baseMount, this.props.totpKey).then((code) => { - this.setState({ totpValue: code }); - }) - this.setState({}); + this.updateTOTPCode(); }, 3000); } @@ -62,8 +66,6 @@ export class TOTPViewPage extends Page {
{await (async () => { - - try { const elem = await Promise.all(Array.from(await getTOTPKeys(this.state.baseMount)).map(async (key) =>