handle an error from the hit endpoint
This commit is contained in:
parent
87afa418b2
commit
732156dcd6
1 changed files with 6 additions and 1 deletions
|
@ -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 %}
|
||||||
|
|
Loading…
Reference in a new issue