From c161bb013e091c0bcc524f07d50c028d9daf8cce Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Tue, 25 Feb 2020 14:28:47 -0600 Subject: Change action GETs to POST (#10462) * Change action GETs to POST * submite = submit + smite * No more # href * Fix test * Match other tests * Explicit csrf Signed-off-by: jolheiser Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> --- web_src/js/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'web_src/js') diff --git a/web_src/js/index.js b/web_src/js/index.js index d4f8bb40e4..ec39a1c40c 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2469,6 +2469,7 @@ $(document).ready(async () => { // Helpers. $('.delete-button').click(showDeletePopup); $('.add-all-button').click(showAddAllPopup); + $('.link-action').click(linkAction); $('.delete-branch-button').click(showDeletePopup); @@ -2735,6 +2736,19 @@ function showAddAllPopup() { return false; } +function linkAction() { + const $this = $(this); + $.post($this.data('url'), { + _csrf: csrf + }).done((data) => { + if (data.redirect) { + window.location.href = data.redirect; + } else { + window.location.reload(); + } + }); +} + function initVueComponents() { const vueDelimeters = ['${', '}']; -- cgit v1.2.3