// Dependencies import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useToast } from 'shared/hooks/use-toast.mjs' // Components import { BackToAccountButton } from './shared.mjs' export const ns = ['account', 'toast'] export const ReloadAccount = ({ app, title = false }) => { const { account, setAccount, token } = useAccount() const backend = useBackend(token) const { t } = useTranslation(ns) const toast = useToast() const reload = async () => { app.startLoading() const result = await backend.reloadAccount() if (result.success) { setAccount(result.data.account) toast.success({t('nailedIt')}) } else toast.for.backendError() app.stopLoading() } return ( <> {title ?

{t('reloadMsg1')}

: null}

{t('reloadMsg2')}

) }