diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-27 00:06:31 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-07-27 00:06:31 +0200 |
commit | c60b7b34759f866549752a97a83c12f04f8a903e (patch) | |
tree | a732b950e38036bf007b2ae694146ccf99638a1a /static | |
parent | Change html-id to randomly generate. (diff) | |
download | calp-c60b7b34759f866549752a97a83c12f04f8a903e.tar.gz calp-c60b7b34759f866549752a97a83c12f04f8a903e.tar.xz |
Crash properly on overflow on remove event.
Diffstat (limited to '')
-rw-r--r-- | static/script.js | 12 |
1 files changed, 7 insertions, 5 deletions
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 |