aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/assets
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/main/assets')
-rw-r--r--juick-server/src/main/assets/scripts.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/juick-server/src/main/assets/scripts.js b/juick-server/src/main/assets/scripts.js
index 19383e94..5bbbe6f2 100644
--- a/juick-server/src/main/assets/scripts.js
+++ b/juick-server/src/main/assets/scripts.js
@@ -350,11 +350,15 @@ function showCommentForm(mid, rid) {
credentials: 'omit'
}).then(response => {
if (response.ok) {
- return response.json();
+ response.json().then(result => {
+ if (result.newMessage) {
+ window.location.href = new URL(`${mid}#${result.newMessage.rid}`, window.location.href);
+ } else {
+ alert(result.text);
+ }
+ window.location.reload(true);
+ });
}
- }).then(reply => {
- window.location.href = new URL(`${mid}#${reply.rid}`, window.location.href);
- window.location.reload(true);
}).catch(error => {
alert(error.message);
})