Merge remote-tracking branch 'origin/21-add-functionality-for-listing-query-results-in-frontend' into 21-add-functionality-for-listing-query-results-in-frontend
This commit is contained in:
commit
32ba4995be
@ -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);
|
||||
|
@ -52,8 +52,7 @@
|
||||
<option>Dataset</option>
|
||||
<option>API</option>
|
||||
</optgroup>
|
||||
<optgroup label="Other categories">
|
||||
<option>a category</option>
|
||||
<optgroup id="other-categories" label="Other categories">
|
||||
</optgroup>
|
||||
</select>
|
||||
<input type="search" name="query" id="search-entry" placeholder="Search">
|
||||
|
Loading…
Reference in New Issue
Block a user