summaryrefslogtreecommitdiff
path: root/public/static/js/travelynx-actions.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/static/js/travelynx-actions.js')
-rw-r--r--public/static/js/travelynx-actions.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js
index 3f1eb89..583c806 100644
--- a/public/static/js/travelynx-actions.js
+++ b/public/static/js/travelynx-actions.js
@@ -1,11 +1,11 @@
-function tvly_run(link, req, redir, err_callback) {
+function tvly_run(link, req, err_callback) {
var error_icon = '<i class="material-icons">error</i>';
var progressbar = $('<div class="progress"><div class="indeterminate"></div></div>');
link.hide();
link.after(progressbar);
$.post('/action', req, function(data) {
if (data.success) {
- $(location).attr('href', redir);
+ $(location).attr('href', data.redirect_to);
} else {
M.toast({html: error_icon + ' ' + data.error});
progressbar.remove();
@@ -25,7 +25,7 @@ $(document).ready(function() {
station: link.data('station'),
train: link.data('train'),
};
- tvly_run(link, req, '/');
+ tvly_run(link, req);
});
$('.action-checkout').click(function() {
var link = $(this);
@@ -34,7 +34,7 @@ $(document).ready(function() {
station: link.data('station'),
force: link.data('force'),
};
- tvly_run(link, req, '/s/' + req.station, function() {
+ tvly_run(link, req, function() {
link.append(' – Ohne Echtzeitdaten auschecken?')
link.data('force', true);
});
@@ -45,7 +45,7 @@ $(document).ready(function() {
action: 'undo',
undo_id: link.data('id'),
};
- tvly_run(link, req, '/');
+ tvly_run(link, req);
});
$('.action-cancelled-from').click(function() {
var link = $(this);
@@ -54,7 +54,7 @@ $(document).ready(function() {
station: link.data('station'),
train: link.data('train'),
};
- tvly_run(link, req, '/');
+ tvly_run(link, req);
});
$('.action-cancelled-to').click(function() {
var link = $(this);
@@ -63,19 +63,19 @@ $(document).ready(function() {
station: link.data('station'),
force: true,
};
- tvly_run(link, req, '/');
+ tvly_run(link, req);
});
$('.action-delete').click(function() {
var link = $(this);
var req = {
action: 'delete',
- ids: link.data('id'),
+ id: link.data('id'),
checkin: link.data('checkin'),
checkout: link.data('checkout'),
};
really_delete = confirm("Diese Zugfahrt wirklich löschen? Der Eintrag wird sofort aus der Datenbank entfernt und kann nicht wiederhergestellt werden.");
if (really_delete) {
- tvly_run(link, req, '/history');
+ tvly_run(link, req);
}
});
});