summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--haunt/static/js/comment-reaction.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/haunt/static/js/comment-reaction.js b/haunt/static/js/comment-reaction.js
index 844f604..bae9fed 100644
--- a/haunt/static/js/comment-reaction.js
+++ b/haunt/static/js/comment-reaction.js
@@ -34,9 +34,16 @@ function postReaction(reaction) {
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.onload = function(data) {
- if (xhr.status != 200) {
- alert("Failed to react.");
- } else {
+ switch (xhr.status) {
+ case 200:
+ break;
+ case 429:
+ alert("Failed -- you can react at most once an hour.");
+ break;
+ default:
+ let resp = JSON.parse(xhr.response);
+ alert("Failed -- " + resp.error);
+ break;
}
}
xhr.onerror = function(error) {