Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$$('.tr-li').on('swipeout:deleted', function (e) {
var id = $$(e.target).children("div.swipeout-actions-opened").find("a.delete-transaction").data('id');
var csrf = document.querySelector("meta[name=csrf]").content;
Framework7.request({
url: '/m/transactions/' + id + "?_format=json",
contentType: "application/json",
type: 'DELETE',
headers: {
"X-CSRF-TOKEN": csrf
},
success: function(data, status, xhr) {
var response = JSON.parse(data);
if (response.new_balance) {
$$("#account_id_" + response.account_id).text(response.new_balance);
}
},
error: function(xhr, status) {
alert("Something went wrong, check server logs");
}
});