fix(auth-callback): attendre router.isReady et nettoyer l’URL après échange du code
Some checks failed
build-and-push-ext / build_push (push) Has been cancelled
Some checks failed
build-and-push-ext / build_push (push) Has been cancelled
This commit is contained in:
parent
427a8854df
commit
0b905b34eb
@ -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/
|
||||
|
@ -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 (
|
||||
<DefaultDoubleSidePage title={"Login"} image={backgroundImage}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user