mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 12:53:57 +01:00
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> (cherry picked from commit 0676bf52f95b9c9ac6f5679bd263d844e6a83fa1)
This commit is contained in:
parent
90a62b87c0
commit
3723caf762
1 changed files with 7 additions and 10 deletions
|
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue