From c60b7b34759f866549752a97a83c12f04f8a903e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 27 Jul 2020 00:06:31 +0200 Subject: Crash properly on overflow on remove event. --- static/script.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'static/script.js') diff --git a/static/script.js b/static/script.js index 0f0775fb..35e927f5 100644 --- a/static/script.js +++ b/static/script.js @@ -151,6 +151,7 @@ class EventCreator { /* [0, 1) -- where are we in the container */ /* Ronud to force steps of quarters */ + /* TODO possibly have floor_time instead */ let time = round_time(pos_in(this, e), round_to); event.dataset.time1 = time; @@ -246,13 +247,14 @@ async function remove_event (element) { }); console.log(response); + toggle_child_popup(element); + if (response.status < 200 || response.status >= 300) { - alert(`Error removing event ${response.status}\n${response.statusText}`) + let body = await response.text(); + alert(`HTTP error ${response.status}\n${body}`) + } else { + element.remove(); } - - toggle_child_popup(element); - element.style.background = "black !important"; - element.style.color = "black !important"; } var bar_object = false -- cgit v1.2.3