From 9baea1263a1cd3961545d2b5c0ac0fc1190a084d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 8 Jan 2018 15:18:18 +0100 Subject: redirect to index after deleting post --- bucky/app/bucky.js | 2 +- public/assets/js/lib/views/details/settings.js | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js index c85ef45..940e02d 100644 --- a/bucky/app/bucky.js +++ b/bucky/app/bucky.js @@ -249,7 +249,7 @@ var bucky = module.exports = { var promises = [ threadPromise ].concat(commentPromises).concat(filePromises) Promise.all(promises).then( () => { next() - }).catch( () => { + }).catch( (err) => { res.sendStatus(500) }) }, diff --git a/public/assets/js/lib/views/details/settings.js b/public/assets/js/lib/views/details/settings.js index a7dd050..565dfeb 100644 --- a/public/assets/js/lib/views/details/settings.js +++ b/public/assets/js/lib/views/details/settings.js @@ -226,10 +226,10 @@ var ThreadSettingsForm = FormView.extend({ url: "/api/thread/" + id, headers: { "csrf-token": $("[name=_csrf]").attr("value") }, data: JSON.stringify({ csrf: csrf() }), - dataType: "application/json", + dataType: "json", success: function(){ window.location.href = "/" - }, + } }) } }, @@ -252,14 +252,11 @@ var ThreadSettingsForm = FormView.extend({ url: "/api/file/" + file_id, headers: { "csrf-token": $("[name=_csrf]").attr("value") }, data: JSON.stringify({ csrf: csrf() }), - dataType: "application/json", + dataType: "json", success: function(data){ console.log(data) $parent.remove() - }, - error: function(data){ - $parent.remove() - }, + } }) } }, -- cgit v1.2.3-70-g09d2