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