diff --git a/next/components/atoms/FilterAccordion.js b/next/components/atoms/FilterAccordion.js index 4cc8dbce..14f40b48 100644 --- a/next/components/atoms/FilterAccordion.js +++ b/next/components/atoms/FilterAccordion.js @@ -117,7 +117,7 @@ export function CheckboxFilterAccordion({ facet = "" }) { const { t } = useTranslation('search'); - const { asPath } = useRouter(); + const { asPath, locale } = useRouter(); const [options, setOptions] = useState([]); const [allOptions, setAllOptions] = useState([]); const [search, setSearch] = useState(""); @@ -145,14 +145,14 @@ export function CheckboxFilterAccordion({ const MoreOptions = useCallback(async () => { try { const params = asPath.replace("/search?", ""); - const res = await MoreFacetSearch(facet, params); + const res = await MoreFacetSearch(facet, params, locale); setAllOptions(res.values); setOptions(res.values); setShowAll(true); } catch (error) { console.error("Failed to load more options", error); } - }, [asPath, facet]); + }, [asPath, facet, locale]); function toggleShowAll() { if (showAll) { diff --git a/next/pages/api/datasets/getMoreFacetSearchDatasets.js b/next/pages/api/datasets/getMoreFacetSearchDatasets.js index fd6a01f3..2a42e01c 100644 --- a/next/pages/api/datasets/getMoreFacetSearchDatasets.js +++ b/next/pages/api/datasets/getMoreFacetSearchDatasets.js @@ -2,9 +2,10 @@ import axios from "axios"; const API_URL= `${process.env.NEXT_PUBLIC_API_URL}/facet_values/` -export default async function getMoreFacetSearchDatasets(facet, params) { +export default async function getMoreFacetSearchDatasets(facet, params, locale) { try { - const res = await axios.get(`${API_URL}?facet=${facet}&${params}`) + const localeParam = locale ? `&locale=${locale}` : "" + const res = await axios.get(`${API_URL}?facet=${facet}&${params}${localeParam}`) return res.data } catch (error) { console.error(error)