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

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) => {
return resp.text(); if (resp.ok) {
return resp.text();
} else {
return "no";
}
}).then((data) => { }).then((data) => {
hits.innerHTML = data; hits.innerHTML = data;
}); });
</script> </script>
{% endblock main_content %} {% endblock main_content %}