From c06f440e4a41853fc30ff5b231c68bd766ba96fa Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 11 Dec 2017 09:52:40 +0100 Subject: remove comments --- public/assets/js/lib/views/details/comments.js | 2 ++ public/assets/js/util/format.js | 3 +++ 2 files changed, 5 insertions(+) (limited to 'public/assets/js') diff --git a/public/assets/js/lib/views/details/comments.js b/public/assets/js/lib/views/details/comments.js index 202ae72..c679d22 100644 --- a/public/assets/js/lib/views/details/comments.js +++ b/public/assets/js/lib/views/details/comments.js @@ -62,6 +62,8 @@ var CommentsView = FormView.extend({ $.ajax({ method: "DELETE", url: "/api/comment/" + id, + headers: { "csrf-token": $("[name=_csrf]").attr("value") }, + data: { csrf: csrf() }, success: function(){ window.location.reload() }, diff --git a/public/assets/js/util/format.js b/public/assets/js/util/format.js index bfabfc3..3256ce5 100644 --- a/public/assets/js/util/format.js +++ b/public/assets/js/util/format.js @@ -5,6 +5,9 @@ var is_mobile = is_iphone || is_ipad || is_android var is_desktop = ! is_mobile; document.body.classList.add(is_desktop ? 'desktop' : 'mobile'); +function csrf() { + return $("[name=_csrf]").attr("value") +} function commatize (n) { var nums = [], i, counter = 0, r = Math.floor if (n > 1024) { -- cgit v1.2.3-70-g09d2