From 8872176eacf560bb52fe3c11de52d9124e328991 Mon Sep 17 00:00:00 2001 From: hqjang-pepper Date: Fri, 24 Nov 2023 15:12:57 +0900 Subject: [PATCH] fix recovery redirect logic --- .../mpc-react-playground/src/pages/HomePage.tsx | 17 +++++++---------- .../mpc-react-playground/src/pages/Recover.tsx | 6 +++++- .../src/services/mpcCoreKit.tsx | 2 ++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/mpc-core-kit-web/mpc-react-playground/src/pages/HomePage.tsx b/mpc-core-kit-web/mpc-react-playground/src/pages/HomePage.tsx index be55b781..86b69ebb 100644 --- a/mpc-core-kit-web/mpc-react-playground/src/pages/HomePage.tsx +++ b/mpc-core-kit-web/mpc-react-playground/src/pages/HomePage.tsx @@ -1,7 +1,6 @@ import { COREKIT_STATUS } from "@web3auth/mpc-core-kit"; import React, { useEffect } from "react"; -// import { useNavigate } from "react-router-dom"; import Console from "../components/Console"; import Header from "../components/Header"; // import ShareDescriptionComponent from "../components/ShareDescription"; @@ -9,29 +8,27 @@ import Sidebar from "../components/Sidebar"; import { useMPCCoreKit } from "../services/mpcCoreKit"; function HomePage() { - const { coreKitStatus, provider, keyDetails } = useMPCCoreKit(); - // const navigate = useNavigate(); - - - + const { coreKitStatus, keyDetails } = useMPCCoreKit(); useEffect(() => { + console.log("coreKitStatus", coreKitStatus); if (coreKitStatus === COREKIT_STATUS.REQUIRED_SHARE) { - // navigate("/recover"); + console.log("require more share"); + // Redirect to "/recover" when REQUIRED_SHARE + window.location.href = "/recover"; } - }, []); + }, [coreKitStatus]); return (
- {provider ? ( + {coreKitStatus === COREKIT_STATUS.LOGGED_IN ? (

Welcome to Web3Auth MPC Core Kit Playground

-