Refactor useEffect
This commit is contained in:
parent
eb9896df87
commit
57e2c0c628
@ -41,15 +41,15 @@ function App() {
|
||||
<Route
|
||||
path="/onboarding-success"
|
||||
element={<OnboardingSuccess />}
|
||||
></Route>
|
||||
/>
|
||||
<Route
|
||||
path="/validator"
|
||||
element={<Validator />}
|
||||
></Route>
|
||||
/>
|
||||
<Route
|
||||
path="/validator-success"
|
||||
element={<ValidatorSuccess />}
|
||||
></Route>
|
||||
/>
|
||||
</Route>
|
||||
<Route path="*" element={<PageNotFound />} />
|
||||
</Routes>
|
||||
|
@ -16,6 +16,7 @@ const TermsAndConditionsBox = ({ height, onLoad }: TermsAndConditionsBoxProps )
|
||||
|
||||
function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {
|
||||
setNumPages(numPages);
|
||||
|
||||
if (onLoad){
|
||||
onLoad();
|
||||
};
|
||||
|
@ -22,19 +22,21 @@ const ConnectWallet = () => {
|
||||
}, [checkPersistedState, signClient, session]);
|
||||
|
||||
useEffect(() => {
|
||||
if (session) {
|
||||
if (!session) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (redirectTo) {
|
||||
navigate(`/${redirectTo}`, {
|
||||
state: location.state
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
navigate("/sign-with-nitro-key", {
|
||||
state: location.state
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [session, navigate, redirectTo, location.state]);
|
||||
|
||||
const handler = async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user