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