misc: addressed ux issues

This commit is contained in:
Sheen Capadngan
2024-10-23 00:00:15 +08:00
parent 5debeb421d
commit 571709370d
4 changed files with 18 additions and 15 deletions
+6 -4
View File
@@ -32,8 +32,8 @@ const codeInputProps = {
} as const;
type Props = {
successCallback: () => void;
closeMfa: () => void;
successCallback: () => void | Promise<void>;
closeMfa?: () => void;
hideLogo?: boolean;
email: string;
};
@@ -58,8 +58,10 @@ export const Mfa = ({ successCallback, closeMfa, hideLogo, email }: Props) => {
SecurityClient.setMfaToken("");
SecurityClient.setToken(token);
successCallback();
closeMfa();
await successCallback();
if (closeMfa) {
closeMfa();
}
} catch (error) {
if (triesLeft) {
setTriesLeft((left) => {