From 74ae167e3cfeb9805bc92eff8155d07a34e2d005 Mon Sep 17 00:00:00 2001 From: Sosthene Date: Wed, 11 Jun 2025 15:15:48 +0200 Subject: [PATCH] Set userPairingId on connect --- src/App.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index ae3cb3c..2162a11 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -61,6 +61,18 @@ function App() { } }, [isConnected, iframeUrl]); + useEffect(() => { + if (isConnected && userPairingId === null) { + const messageBus = MessageBus.getInstance(iframeUrl); + messageBus.isReady().then(() => { + messageBus.getUserPairingId().then((userPairingId: string) => { + UserStore.getInstance().pair(userPairingId); + setUserPairingId(UserStore.getInstance().getUserPairingId()); + }) + }); + } + }, [isConnected, userPairingId]); + // Gestionnaire pour afficher la modale de connexion const handleLogin = useCallback(() => { // Afficher la modale de connexion