mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
Catch CSRF issues
This commit is contained in:
29
public/v1/js/ff/rules/index.js
vendored
29
public/v1/js/ff/rules/index.js
vendored
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user