summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-01-08 15:18:18 +0100
committerJules Laplace <julescarbon@gmail.com>2018-01-08 15:18:18 +0100
commit9baea1263a1cd3961545d2b5c0ac0fc1190a084d (patch)
tree869f3125a82ad77b0f7f36fe8f95e2a641ba5b33
parent66d405fe450ff24e796520c5fb71bff59cbd1804 (diff)
redirect to index after deleting post
-rw-r--r--bucky/app/bucky.js2
-rw-r--r--public/assets/js/lib/views/details/settings.js11
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()
- },
+ }
})
}
},