Catch CSRF issues

This commit is contained in:
James Cole
2021-10-23 09:29:07 +02:00
parent 4d9c4a415d
commit c2c8c42ef3
6 changed files with 76 additions and 46 deletions

View File

@@ -59,6 +59,32 @@ function readCookie(name) {
return null;
}
function moveRuleGroup(e) {
let box = $(e.currentTarget);
var direction = box.data('direction');
var groupId = box.data('id');
$.post(moveRuleGroupUrl, {_token: token, direction: direction, id: groupId}).then(function () {
location.reload();
}).fail(function() {
alert('I failed :(');
});
return false;
}
function duplicateRule(e) {
let box = $(e.currentTarget);
var ruleId = box.data('id');
$.post(duplicateRuleUrl, {_token: token, id: ruleId}).then(function () {
location.reload();
}).fail(function() {
alert('I failed :(');
});
return false;
}
$(function () {
"use strict";
@@ -71,6 +97,9 @@ $(function () {
}
);
$('.move-group').click(moveRuleGroup);
$('.duplicate-rule').click(duplicateRule);
$('.rules-box').each(function (i, v) {
var box = $(v);
var groupId = box.data('group');