diff --git a/src/components/UserButton/UserButton.tsx b/src/components/UserButton/UserButton.tsx index ad43dc80..9b46434d 100644 --- a/src/components/UserButton/UserButton.tsx +++ b/src/components/UserButton/UserButton.tsx @@ -11,7 +11,10 @@ interface UserButtonProps { } export const UserButton = ({ onLogout }: UserButtonProps) => { - const { t } = useTranslation(); + const { + t, + i18n: { language }, + } = useTranslation(); const { sm } = useMediaQueries(); const data = useLoaderData() as components['schemas']['YksiloCsrfDto'] | null; diff --git a/src/routes/LandingPage/LandingPage.tsx b/src/routes/LandingPage/LandingPage.tsx index f0c3e058..9154ded0 100644 --- a/src/routes/LandingPage/LandingPage.tsx +++ b/src/routes/LandingPage/LandingPage.tsx @@ -8,8 +8,10 @@ import { MdArrowForward } from 'react-icons/md'; import { NavLink, useLocation, useNavigate, useRouteLoaderData } from 'react-router'; const LandingPage = () => { - const { i18n } = useTranslation(); - const { t } = useTranslation(); + const { + t, + i18n: { language }, + } = useTranslation(); const location = useLocation(); const rootLoaderData = useRouteLoaderData('root') as components['schemas']['YksiloCsrfDto']; @@ -19,8 +21,8 @@ const LandingPage = () => { const loginLink = useLoginLink({ callbackURL: state?.callbackURL - ? `/${i18n.language}/${state?.callbackURL}` - : `/${i18n.language}/${t('slugs.profile.index')}/${t('slugs.profile.preferences')}`, + ? `/${language}/${state?.callbackURL}` + : `/${language}/${t('slugs.profile.index')}/${t('slugs.profile.preferences')}`, }); // Redirect to root if already logged-in @@ -62,7 +64,7 @@ const LandingPage = () => {