chore: hide nav if error, more timeout
This commit is contained in:
@@ -133,15 +133,11 @@ export const ApplyCodeForm = () => {
|
||||
|
||||
// go to main page when successfully applied
|
||||
useEffect(() => {
|
||||
let to: ReturnType<typeof setTimeout>;
|
||||
if (status === 'successful') {
|
||||
to = setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
navigate(Routes.REFERRALS);
|
||||
}, RELOAD_DELAY);
|
||||
}
|
||||
return () => {
|
||||
if (to) clearTimeout(to);
|
||||
};
|
||||
}, [navigate, status]);
|
||||
|
||||
// go to main page if the current pubkey is already a referrer or referee
|
||||
|
||||
@@ -77,6 +77,7 @@ export const useReferral = (args: UseReferralArgs) => {
|
||||
},
|
||||
skip: !referralSet?.id,
|
||||
fetchPolicy: 'cache-and-network',
|
||||
//context: { isEnlargedTimeout: true },
|
||||
});
|
||||
|
||||
const referees = compact(
|
||||
|
||||
@@ -46,7 +46,7 @@ export const Referrals = () => {
|
||||
|
||||
const error = refereeError || referrerError;
|
||||
const loading = refereeLoading || referrerLoading;
|
||||
const showNav = !loading && !referrer && !referee;
|
||||
const showNav = !loading && !error && !referrer && !referee;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -64,8 +64,9 @@ export const Referrals = () => {
|
||||
<Loader />
|
||||
</div>
|
||||
) : error ? (
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
|
||||
Something went wrong
|
||||
<div className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-center">
|
||||
<p>Something went wrong</p>
|
||||
<span className="text-xs">{error.message}</span>
|
||||
</div>
|
||||
) : (
|
||||
<Outlet />
|
||||
|
||||
Reference in New Issue
Block a user