From 83a64c64ce17767a9ef301be8ee14d0cd2c1ed23 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Wed, 16 Aug 2023 11:54:12 -0400 Subject: [PATCH] refactor: revert iframe listener --- src/components/blocks/MyAccount.js | 33 ------------------------------ 1 file changed, 33 deletions(-) diff --git a/src/components/blocks/MyAccount.js b/src/components/blocks/MyAccount.js index 3bc35a55..9c7ea4fc 100644 --- a/src/components/blocks/MyAccount.js +++ b/src/components/blocks/MyAccount.js @@ -57,39 +57,6 @@ const MyAccount = ({ openModal = false, onClose, isHeader = true }) => { } }, []); - useEffect(() => { - // Function to handle the message event - const handleMessage = event => { - if (event.origin !== window.location.origin) { - return; - } - console.log('Received message:', event.data); - if ( - event?.data?.serverAddress && - validateUrl(event?.data?.serverAddress) - ) { - dispatch( - signIn({ - apiKey: event?.data?.apiKey, - serverAddress: event?.data?.serverAddress, - }), - ); - setServerAddress(null); - setApiKey(null); - setIsLogInModalOpen(false); - } - }; - - // Add the event listener - window.addEventListener('message', handleMessage, false); - - // Return a function that will be called when the component unmounts - return () => { - // Remove the event listener - window.removeEventListener('message', handleMessage, false); - }; - }, []); - return ( {isHeader && (