aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/admin
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2024-02-25 14:36:11 +0200
committerGitHub <noreply@github.com>2024-02-25 20:36:11 +0800
commit0676bf52f95b9c9ac6f5679bd263d844e6a83fa1 (patch)
tree97d8835af8cbbc7def2de5f7bc3cff94174e8d0c /web_src/js/features/admin
parentf9207b09479df964872d68842469991042b5497f (diff)
downloadgitea-0676bf52f95b9c9ac6f5679bd263d844e6a83fa1.tar.gz
gitea-0676bf52f95b9c9ac6f5679bd263d844e6a83fa1.zip
Remove jQuery AJAX from the notice selection deletion button (#29381)
- Removed all jQuery AJAX calls and replaced with our fetch wrapper - Tested the repo notice selection deletion button functionality and it works as before Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Diffstat (limited to 'web_src/js/features/admin')
-rw-r--r--web_src/js/features/admin/common.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js
index 044976ea7b..5354216e3d 100644
--- a/web_src/js/features/admin/common.js
+++ b/web_src/js/features/admin/common.js
@@ -1,8 +1,9 @@
import $ from 'jquery';
import {checkAppUrl} from '../common-global.js';
import {hideElem, showElem, toggleElem} from '../../utils/dom.js';
+import {POST} from '../../modules/fetch.js';
-const {csrfToken, appSubUrl} = window.config;
+const {appSubUrl} = window.config;
export function initAdminCommon() {
if ($('.page-content.admin').length === 0) {
@@ -204,22 +205,18 @@ export function initAdminCommon() {
break;
}
});
- $('#delete-selection').on('click', function (e) {
+ $('#delete-selection').on('click', async function (e) {
e.preventDefault();
const $this = $(this);
$this.addClass('loading disabled');
- const ids = [];
+ const data = new FormData();
$checkboxes.each(function () {
if ($(this).checkbox('is checked')) {
- ids.push($(this).data('id'));
+ data.append('ids[]', $(this).data('id'));
}
});
- $.post($this.data('link'), {
- _csrf: csrfToken,
- ids
- }).done(() => {
- window.location.href = $this.data('redirect');
- });
+ await POST($this.data('link'), {data});
+ window.location.href = $this.data('redirect');
});
}
}