From 0b905b34ebd965f42d7e22f8af0f56e1fb2d276a Mon Sep 17 00:00:00 2001 From: Debian Dev4 Date: Wed, 17 Sep 2025 13:05:01 +0000 Subject: [PATCH] =?UTF-8?q?fix(auth-callback):=20attendre=20router.isReady?= =?UTF-8?q?=20et=20nettoyer=20l=E2=80=99URL=20apr=C3=A8s=20=C3=A9change=20?= =?UTF-8?q?du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 +- .../Components/Layouts/LoginCallback/index.tsx | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index db47b9df..f572885e 100644 --- a/.env.example +++ b/.env.example @@ -46,7 +46,7 @@ NEXT_PUBLIC_HOTJAR_VERSION= # RELAY_URLS=wss://demo.4nkweb.com/ws RELAY_URLS=wss://dev4.4nkweb.com/ws # SIGNER_WS_URL=https://dev4.4nkweb.com/signer/ -SIGNER_WS_URL=https://dev4.4nkweb.com/signer/ +SIGNER_WS_URL=https://dev3.4nkweb.com/signer/ # IHM URLS # VITE_BOOTSTRAPURL=http://sdk_relay:8090/ diff --git a/src/front/Components/Layouts/LoginCallback/index.tsx b/src/front/Components/Layouts/LoginCallback/index.tsx index 397e7adb..f8433c30 100644 --- a/src/front/Components/Layouts/LoginCallback/index.tsx +++ b/src/front/Components/Layouts/LoginCallback/index.tsx @@ -75,12 +75,6 @@ export default function LoginCallBack() { const code = router.query["code"]; if (code) { try { - // Nettoyer l'URL pour ne garder que la racine - const rootUrl = window.location.origin; - if (window.location.href !== rootUrl) { - window.history.replaceState({}, document.title, rootUrl); - } - const user: any = await Auth.getInstance().idNotAuth(code as string); // Extract both user data and auth token from the response @@ -109,6 +103,12 @@ export default function LoginCallBack() { setIsAuthModalOpen(true); console.log('[LoginCallback] authToken stored successfully'); + // Nettoyer l'URL pour ne garder que la racine (après succès) + const rootUrl = window.location.origin; + if (window.location.href !== rootUrl) { + window.history.replaceState({}, document.title, rootUrl); + } + return; } catch (e: any) { if (e.http_status === 401 && e.message === "Email not found") { @@ -122,8 +122,11 @@ export default function LoginCallBack() { } return router.push(Module.getInstance().get().modules.pages.Login.props.path + "?error=2"); } + if (!router.isReady) { + return; + } getUser(); - }, [router]); + }, [router, router.isReady]); return (