aboutsummaryrefslogtreecommitdiff
path: root/src/main/assets
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-09-09 19:46:47 +0300
committerGravatar Vitaly Takmazov2024-09-09 20:22:19 +0300
commit291f4498320b2325093fb92cc9fbd9b4cb815782 (patch)
tree41bee7955b74e1c0460cacccdf27a1eb00d247ea /src/main/assets
parenta2be40353c07ef3777e2a5ef250856dc9fd0a30f (diff)
Handle post errors
Diffstat (limited to 'src/main/assets')
-rw-r--r--src/main/assets/scripts.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/assets/scripts.js b/src/main/assets/scripts.js
index 1583cedc..12c4d9b2 100644
--- a/src/main/assets/scripts.js
+++ b/src/main/assets/scripts.js
@@ -251,6 +251,10 @@ function closeDialogListener(ev) {
}
}
+/**
+ *
+ * @param {Response} response
+ */
function handleErrors(response) {
if (!response.ok) {
throw Error(response.statusText)
@@ -310,8 +314,7 @@ function showCommentForm(mid, rid) {
method: 'POST',
body: formData,
credentials: 'include'
- }).then(handleErrors)
- .then(response => response.json())
+ }).then(response => response.json())
.then(result => {
if (result.newMessage) {
window.location.hash = `#${result.newMessage.rid}`
@@ -663,8 +666,7 @@ ready(() => {
method: 'POST',
body: formData,
credentials: 'include'
- }).then(handleErrors)
- .then(response => response.json())
+ }).then(response => response.json())
.then(result => {
if (result.newMessage) {
window.location.href = new URL(`/m/${result.newMessage.mid}`, window.location.href).href