mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
fix(experience): move the navigate method to useEffect (#5027)
* fix(experience): move the navigate method to useEffect move the navigate method to useEffect * fix(experience): replace current nav history replace current nav history
This commit is contained in:
parent
d234c1483c
commit
f74693d861
1 changed files with 9 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
import { useContext } from 'react';
|
||||
import { useContext, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import SecondaryPageLayout from '@/Layout/SecondaryPageLayout';
|
||||
|
@ -20,10 +20,14 @@ const SingleSignOnConnectors = () => {
|
|||
// Listen to native message
|
||||
useNativeMessageListener();
|
||||
|
||||
// Return to the previous page if no email and no connectors are available in the context
|
||||
if (!email || ssoConnectors.length === 0) {
|
||||
navigate('../email');
|
||||
}
|
||||
useEffect(() => {
|
||||
// Return to the previous page if no email and no connectors are available in the context
|
||||
if (!email || ssoConnectors.length === 0) {
|
||||
navigate('../email', {
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
}, [email, navigate, ssoConnectors.length]);
|
||||
|
||||
return (
|
||||
<SecondaryPageLayout
|
||||
|
|
Loading…
Add table
Reference in a new issue