diff --git a/src/main/resources/static/main.js b/src/main/resources/static/main.js index a563530..ca5db42 100644 --- a/src/main/resources/static/main.js +++ b/src/main/resources/static/main.js @@ -198,7 +198,23 @@ function updateSections() { } } +// fetches the further categories used in the filter function +function fetchCategories() { + const fetchURL = new URL( + "api/v1/categories" , baseURL); + fetch(fetchURL) + .then(resp => resp.json()) + .then((data) => { + for (let i = 0; i < data.length; i++) { + let category = data[i].toLowerCase(); + category = category.charAt(0).toUpperCase() + category.slice(1); + document.getElementById("other-categories").appendChild(new Option(category)); + } + }); +} + window.onload = function () { + fetchCategories(); updateSections(); if (searchBar.value !== "") { search(searchBar.value); diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index c894c6a..e5f46f2 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -52,8 +52,7 @@ - - +