From 2386a2e04bd3ab69b298af5e8171014d1f4797e3 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 19 Oct 2022 13:00:33 -0500 Subject: [PATCH] fix ban and delete modals --- files/assets/js/ban_modal.js | 2 +- files/assets/js/delete_post_modal.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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));