Skip to content

Commit 519fb4b

Browse files
author
Guru
committed
feat: add critical reset option
1 parent 94ccbd6 commit 519fb4b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

demo/redirect-flow-example/src/components/MFACard.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Card } from "./Card";
44
import { AddShareType, useCoreKit } from "../composibles/useCoreKit";
55
import { BN } from "bn.js";
66
import { HiOutlineMail } from "react-icons/hi";
7+
import { COREKIT_STATUS } from "@web3auth/mpc-core-kit";
8+
import { useNavigate } from "react-router-dom";
79

810
const FACTOR_MAP: Record<string, { title: string; icon?: string }> = {
911
device: { title: "Device", icon: "mobile-icon" },
@@ -24,7 +26,8 @@ const shareDetails = [
2426
}));
2527

2628
const MfaCard: React.FC = () => {
27-
const { setAddShareType, coreKitInstance } = useCoreKit();
29+
const { setAddShareType, coreKitInstance, setCoreKitStatus } = useCoreKit();
30+
const navigate = useNavigate();
2831
const [userInfo, setUserInfo] = React.useState<any>({});
2932

3033
React.useEffect(() => {
@@ -55,6 +58,10 @@ const MfaCard: React.FC = () => {
5558
privKey: new BN(coreKitInstance.state.postBoxKey!, "hex"),
5659
input: { message: "KEY_NOT_FOUND" },
5760
});
61+
await coreKitInstance.logout();
62+
setCoreKitStatus(COREKIT_STATUS.NOT_INITIALIZED)
63+
navigate("/");
64+
window.location.reload();
5865
}
5966

6067
return (

0 commit comments

Comments
 (0)