handle an error from the hit endpoint

This commit is contained in:
Joe Ardent 2024-03-30 16:23:17 -07:00
parent 87afa418b2
commit 732156dcd6
1 changed files with 6 additions and 1 deletions

View File

@ -17,9 +17,14 @@
<script defer> <script defer>
const hits = document.getElementById('hitman-count'); const hits = document.getElementById('hitman-count');
fetch("/hit/{{ page.slug }}").then((resp) => { fetch("/hit/{{ page.slug }}").then((resp) => {
if (resp.ok) {
return resp.text(); return resp.text();
} else {
return "no";
}
}).then((data) => { }).then((data) => {
hits.innerHTML = data; hits.innerHTML = data;
}); });
</script> </script>
{% endblock main_content %} {% endblock main_content %}