diff options
author | John Olheiser <john.olheiser@gmail.com> | 2020-02-25 14:28:47 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 14:28:47 -0600 |
commit | c161bb013e091c0bcc524f07d50c028d9daf8cce (patch) | |
tree | 0638e74576902e5c18cb77b3e469a5435cf707e5 /web_src/js | |
parent | 4427a936b4c7bd07908ccbe96104928dd29cf59d (diff) | |
download | gitea-c161bb013e091c0bcc524f07d50c028d9daf8cce.tar.gz gitea-c161bb013e091c0bcc524f07d50c028d9daf8cce.zip |
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 <john.olheiser@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/index.js | 14 |
1 files changed, 14 insertions, 0 deletions
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 = ['${', '}']; |