diff options
| author | user <user@node5.net> | 2024-12-28 17:34:41 +0100 |
|---|---|---|
| committer | user <user@node5.net> | 2024-12-28 17:34:41 +0100 |
| commit | e449b3053f4b9aabab8abd22a15eb2a2e79dca17 (patch) | |
| tree | cb3f9dcc6cb330bd55c04a94f6a2034885669ab2 /src | |
| parent | 40a5a3bb3aac7e49aaadb33a9e72e7059ae82910 (diff) | |
JS - Fix categories + related error alert
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'); |
