diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/static/main.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/static/main.js b/src/static/main.js index 2aac66f..04ea88a 100644 --- a/src/static/main.js +++ b/src/static/main.js @@ -76,18 +76,19 @@ function alterHeatMapParameter(event) { } async function fetchCategories() { + let response; try { - const response = await fetch("categories.json"); + response = await fetch("categories.json"); if (!response.ok) { // If the response status is not OK, throw an error throw new Error(`HTTP error! Status: ${response.status}`); } - CategoryField.pattern = categories.join('|'); } catch (error) { alert(`Failed to fetch categories\n${error.message}`) } categories = await response.json(); + CategoryField.pattern = categories.join('|'); const CategoriesDataList = document.getElementById('CategoriesDataList'); categories.forEach(function(item){ var option = document.createElement('option'); |
