Skip to content

Commit

Permalink
fix: header links did not include language uri (#3238)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast authored Sep 6, 2024
1 parent 0d7e32a commit 485308b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions frontend/benefit/applicant/src/components/header/useHeader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ROUTES } from 'benefit/applicant/constants';
import { ROUTES, SUPPORTED_LANGUAGES } from 'benefit/applicant/constants';
import AppContext from 'benefit/applicant/context/AppContext';
import useApplicationQuery from 'benefit/applicant/hooks/useApplicationQuery';
import { useTranslation } from 'benefit/applicant/i18n';
Expand All @@ -9,6 +9,7 @@ import { useRouter } from 'next/router';
import { TFunction } from 'next-i18next';
import React, { useEffect, useMemo, useState } from 'react';
import useBackendAPI from 'shared/hooks/useBackendAPI';
import useGetLanguage from 'shared/hooks/useGetLanguage';
import { NavigationItem, OptionType } from 'shared/types/common';

type ExtendedComponentProps = {
Expand All @@ -35,7 +36,9 @@ const useHeader = (): ExtendedComponentProps => {
const openDrawer = Boolean(router?.query?.openDrawer);
const { axios } = useBackendAPI();
const { isNavigationVisible } = React.useContext(AppContext);

const getLanguage = useGetLanguage();
const navigationUriBase =
getLanguage() === SUPPORTED_LANGUAGES.FI ? '/' : `/${getLanguage()}`;
const [hasMessenger, setHasMessenger] = useState<boolean>(false);
const [unreadMessagesCount, setUnredMessagesCount] = useState<
number | undefined | null
Expand Down Expand Up @@ -127,14 +130,14 @@ const useHeader = (): ExtendedComponentProps => {
() => [
{
label: t('common:header.navigation.home'),
url: ROUTES.HOME,
url: `${navigationUriBase}${ROUTES.HOME}`,
},
{
label: t('common:header.navigation.decisions'),
url: ROUTES.DECISIONS,
url: `${navigationUriBase}${ROUTES.DECISIONS}`,
},
],
[t]
[t, navigationUriBase]
);

return {
Expand Down

0 comments on commit 485308b

Please sign in to comment.