Skip to content

Commit

Permalink
add redirect to rewards page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridel1e committed Dec 4, 2023
1 parent 0dda96a commit c874e74
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pages/Rewards/Rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { ConnectWalletButton } from '../../components/common/ConnectWalletButton
import { CopyButton } from '../../components/common/CopyButton/CopyButton.tsx';
import { Page } from '../../components/Page/Page.tsx';
import { getAddresses } from '../../gateway/api/addresses.ts';
import { useSelectedNetwork } from '../../gateway/common/network.ts';
import { useGuardV2 } from '../../hooks/useGuard.ts';
import { rewards$ } from '../../network/cardano/api/rewards/rewards';
import { Eternl } from '../../network/cardano/api/wallet/eternl/eternl';
import { RewardsBugFixing } from './RewardsBugFixing/RewardsBugFixing';
Expand All @@ -27,12 +29,20 @@ import { RewardsError } from './RewardsError/RewardsError';

export const Rewards: FC = () => {
const [rewardsData, loading] = useObservable(rewards$);
const [selectedNetwork] = useSelectedNetwork();
const [addresses] = useObservable(
getAddresses().pipe(filter((addresses) => !!addresses?.length)),
);

const navigate = useNavigate();

useGuardV2(
() => selectedNetwork.name === 'ergo',
() => {
navigate('/swap');
},
);

return (
<Flex col align="center">
{applicationConfig.isRewardsAvailable && (
Expand Down

0 comments on commit c874e74

Please sign in to comment.