From c20ad4375808ac993d8bc426af5d79ed45d3591d Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 9 Mar 2022 17:21:52 +0100 Subject: [PATCH] lg-admin: do not check res value --- .../lightgallery/plugins/admin/lg-admin.js | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/photologue/static/lightgallery/plugins/admin/lg-admin.js b/photologue/static/lightgallery/plugins/admin/lg-admin.js index 1fbdd8f..4092ee4 100644 --- a/photologue/static/lightgallery/plugins/admin/lg-admin.js +++ b/photologue/static/lightgallery/plugins/admin/lg-admin.js @@ -54,14 +54,12 @@ class lgAdmin { body: data, credentials: 'same-origin', }).then(res => { - if(res.ok) { - console.log("Deletion complete, response:", res); + console.log("Deletion complete, response:", res); - // Remove HTML element - document.querySelectorAll(`[data-slide-name='${this.photoId}']`)[0].remove() - this.core.goToNextSlide(); - this.core.refresh(); - } + // Remove HTML element + document.querySelectorAll(`[data-slide-name='${this.photoId}']`)[0].remove() + this.core.goToNextSlide(); + this.core.refresh(); }); } } @@ -79,18 +77,16 @@ class lgAdmin { body: data, credentials: 'same-origin', }).then(res => { - if(res.ok) { - console.log("Report complete, response:", res); + console.log("Report complete, response:", res); - // Update HTML element - const thumbnail = document.querySelectorAll(`[data-slide-name='${this.photoId}']`)[0]; - if (!this.isStaff) { - thumbnail.remove() - this.core.goToNextSlide(); - this.core.refresh(); - } else { - location.reload(); - } + // Update HTML element + const thumbnail = document.querySelectorAll(`[data-slide-name='${this.photoId}']`)[0]; + if (!this.isStaff) { + thumbnail.remove() + this.core.goToNextSlide(); + this.core.refresh(); + } else { + location.reload(); } }); }