From 5e5e8a2cd22ba93a80cd0a41a67b881f915b4c7a Mon Sep 17 00:00:00 2001 From: PhilReact Date: Thu, 25 Apr 2024 12:48:26 +0300 Subject: [PATCH] add conditions for requests --- src/App.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index bc6876b..6015654 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -81,6 +81,13 @@ function App() { const [walletToBeDownloadedError, setWalletToBeDownloadedError] = useState(""); + const holdRefExtState = useRef("not-authenticated") + useEffect(()=> { + if(extState){ + holdRefExtState.current = extState + } + }, [extState]) + const address = useMemo(() => { if (!rawWallet?.address0) return ""; return rawWallet.address0; @@ -342,6 +349,7 @@ function App() { // useEffect(()=> { // rawWalletRef.current = rawWallet // }, [rawWallet]) + useEffect(() => { try { @@ -349,6 +357,7 @@ function App() { chrome.runtime.sendMessage({ action: "getWalletInfo" }, (response) => { if (response && response?.walletInfo) { setRawWallet(response?.walletInfo); + if(holdRefExtState.current === 'web-app-request-payment' || holdRefExtState.current === 'web-app-request-connection') return setExtstate("authenticated"); } });