Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions next/components/atoms/FilterAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions next/pages/api/datasets/getMoreFacetSearchDatasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down