diff --git a/src/components/Earn/Tab.tsx b/src/components/Earn/Tab.tsx index 5d780530..261bae05 100644 --- a/src/components/Earn/Tab.tsx +++ b/src/components/Earn/Tab.tsx @@ -1,4 +1,5 @@ import classNames from 'classnames' +import useAccountId from 'hooks/useAccountId' import { NavLink, useParams } from 'react-router-dom' import { getRoute } from 'utils/route' @@ -11,7 +12,8 @@ interface Props { } export default function Tab(props: Props) { - const { address, accountId } = useParams() + const accountId = useAccountId() + const { address } = useParams() return (
diff --git a/src/components/Header/DesktopHeader.tsx b/src/components/Header/DesktopHeader.tsx index e2d9a696..8e1ff645 100644 --- a/src/components/Header/DesktopHeader.tsx +++ b/src/components/Header/DesktopHeader.tsx @@ -7,7 +7,7 @@ import DesktopNavigation from 'components/Navigation/DesktopNavigation' import RewardsCenter from 'components/RewardsCenter' import Settings from 'components/Settings' import Wallet from 'components/Wallet' -import useCurrentAccount from 'hooks/useCurrentAccount' +import useAccountId from 'hooks/useAccountId' import useStore from 'store' export const menuTree: { pages: Page[]; label: string }[] = [ @@ -20,7 +20,7 @@ export const menuTree: { pages: Page[]; label: string }[] = [ export default function DesktopHeader() { const address = useStore((s) => s.address) const focusComponent = useStore((s) => s.focusComponent) - const currentAccount = useCurrentAccount() + const accountId = useAccountId() function handleCloseFocusMode() { if (focusComponent && focusComponent.onClose) focusComponent.onClose() @@ -52,7 +52,7 @@ export default function DesktopHeader() {
) : (
- {currentAccount && } + {accountId && } {address && } diff --git a/src/components/RewardsCenter.tsx b/src/components/RewardsCenter.tsx index bb063a1b..81048349 100644 --- a/src/components/RewardsCenter.tsx +++ b/src/components/RewardsCenter.tsx @@ -8,11 +8,8 @@ import { Logo } from 'components/Icons' import Overlay from 'components/Overlay' import Text from 'components/Text' import { ASSETS } from 'constants/assets' -import { DEFAULT_SETTINGS } from 'constants/defaultSettings' -import { DISPLAY_CURRENCY_KEY } from 'constants/localStore' import { ORACLE_DENOM } from 'constants/oracle' -import useCurrentAccount from 'hooks/useCurrentAccount' -import useLocalStorage from 'hooks/useLocalStorage' +import useAccountId from 'hooks/useAccountId' import usePrices from 'hooks/usePrices' import useToggle from 'hooks/useToggle' import useUnclaimedRewards from 'hooks/useUnclaimedRewards' @@ -43,8 +40,7 @@ const renderIncentives = (unclaimedRewards: BNCoin[]) => { } export default function RewardsCenter() { - const account = useCurrentAccount() - const accountId = account?.id + const accountId = useAccountId() const [isConfirming, setIsConfirming] = useState(false) const [estimatedFee, setEstimatedFee] = useState(defaultFee) const [showRewardsCenter, setShowRewardsCenter] = useToggle() diff --git a/src/hooks/useAccount.tsx b/src/hooks/useAccount.tsx index 6749fe4a..bcf3a71e 100644 --- a/src/hooks/useAccount.tsx +++ b/src/hooks/useAccount.tsx @@ -2,7 +2,7 @@ import useSWR from 'swr' import getAccount from 'api/accounts/getAccount' -export default function useAccounts(accountId?: string, suspense?: boolean) { +export default function useAccount(accountId?: string, suspense?: boolean) { return useSWR(`account${accountId}`, () => getAccount(accountId || ''), { suspense: suspense, revalidateOnFocus: false,