Add language to inventaire search book

This commit is contained in:
2026-01-22 13:37:42 +01:00
parent 8d3569e5d6
commit 7921a83f30
6 changed files with 33 additions and 9 deletions

View File

@@ -30,7 +30,8 @@
function fetchData(searchTerm, authorId) {
if (searchTerm != null) {
getSearchBooks(data, error, searchTerm, limit, offset.value);
let lang = navigator.language.substring(0,2);
getSearchBooks(data, error, searchTerm, lang, limit, offset.value);
getCountSearchBooks(totalBooksData, errorFetchTotal, searchTerm);
} else if (authorId != null) {
getAuthorBooks(data, error, authorId, limit, offset.value);

View File

@@ -41,8 +41,8 @@ export function getCountSearchBooks(data, error, searchterm) {
return useFetch(data, error,baseUrl + '/search/' + encodeURIComponent(searchterm) + '/count')
}
export function getSearchBooks(data, error, searchterm, limit, offset) {
const queryParams = new URLSearchParams({limit: limit, offset: offset});
export function getSearchBooks(data, error, searchterm, lang, limit, offset) {
const queryParams = new URLSearchParams({lang: lang, limit: limit, offset: offset});
return useFetch(data, error, baseUrl + '/search/' + encodeURIComponent(searchterm) + "?" + queryParams.toString());
}