1
0
Fork 0

Make TOTPView load data right away.

This commit is contained in:
Kitteh 2021-05-22 13:40:12 +01:00
parent 8f2e91bf6b
commit 331d8c9e81

View file

@ -17,12 +17,16 @@ export class RefreshingTOTPGridItem extends Component<{ baseMount: string; totpK
} }
timer: unknown; timer: unknown;
updateTOTPCode(): void {
getTOTPCode(this.props.baseMount, this.props.totpKey).then((code) => {
this.setState({ totpValue: code });
})
}
componentDidMount(): void { componentDidMount(): void {
this.updateTOTPCode();
this.timer = setInterval(() => { this.timer = setInterval(() => {
getTOTPCode(this.props.baseMount, this.props.totpKey).then((code) => { this.updateTOTPCode();
this.setState({ totpValue: code });
})
this.setState({});
}, 3000); }, 3000);
} }
@ -62,8 +66,6 @@ export class TOTPViewPage extends Page {
<br /> <br />
<div id="totpList"> <div id="totpList">
{await (async () => { {await (async () => {
try { try {
const elem = await Promise.all(Array.from(await getTOTPKeys(this.state.baseMount)).map(async (key) => const elem = await Promise.all(Array.from(await getTOTPKeys(this.state.baseMount)).map(async (key) =>
<RefreshingTOTPGridItem <RefreshingTOTPGridItem