diff --git a/files/assets/js/ban_modal.js b/files/assets/js/ban_modal.js index e64878608..2e4d968c9 100644 --- a/files/assets/js/ban_modal.js +++ b/files/assets/js/ban_modal.js @@ -8,7 +8,7 @@ function banModal(link, id, name) { const xhr = createXhrWithFormKey(`/ban_user/${id}?form`, "POST", form); xhr[0].onload = function() { let data - try {data = JSON.parse(xhr.response)} + try {data = JSON.parse(xhr[0].response)} catch(e) {console.log(e)} success = xhr[0].status >= 200 && xhr[0].status < 300; showToast(success, getMessageFromJsonData(success, data)); diff --git a/files/assets/js/delete_post_modal.js b/files/assets/js/delete_post_modal.js index 8133c1bb3..d059b6e37 100644 --- a/files/assets/js/delete_post_modal.js +++ b/files/assets/js/delete_post_modal.js @@ -3,7 +3,7 @@ function delete_postModal(id) { const xhr = createXhrWithFormKey(`/delete_post/${id}`); xhr[0].onload = function() { let data - try {data = JSON.parse(xhr.response)} + try {data = JSON.parse(xhr[0].response)} catch(e) {console.log(e)} success = xhr[0].status >= 200 && xhr[0].status < 300; showToast(success, getMessageFromJsonData(success, data));