diff options
Diffstat (limited to 'web_src/js/features/repo-issue-list.js')
-rw-r--r-- | web_src/js/features/repo-issue-list.js | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js index 64343a8d22..af4586121e 100644 --- a/web_src/js/features/repo-issue-list.js +++ b/web_src/js/features/repo-issue-list.js @@ -5,6 +5,7 @@ import {htmlEscape} from 'escape-goat'; import {confirmModal} from './comp/ConfirmModal.js'; import {showErrorToast} from '../modules/toast.js'; import {createSortable} from '../modules/sortable.js'; +import {DELETE, POST} from '../modules/fetch.js'; function initRepoIssueListCheckboxes() { const $issueSelectAll = $('.issue-checkbox-all'); @@ -146,13 +147,7 @@ function initPinRemoveButton() { const id = Number(el.getAttribute('data-issue-id')); // Send the unpin request - const response = await fetch(el.getAttribute('data-unpin-url'), { - method: 'delete', - headers: { - 'X-Csrf-Token': window.config.csrfToken, - 'Content-Type': 'application/json', - }, - }); + const response = await DELETE(el.getAttribute('data-unpin-url')); if (response.ok) { // Delete the tooltip el._tippy.destroy(); @@ -166,14 +161,7 @@ function initPinRemoveButton() { async function pinMoveEnd(e) { const url = e.item.getAttribute('data-move-url'); const id = Number(e.item.getAttribute('data-issue-id')); - await fetch(url, { - method: 'post', - body: JSON.stringify({id, position: e.newIndex + 1}), - headers: { - 'X-Csrf-Token': window.config.csrfToken, - 'Content-Type': 'application/json', - }, - }); + await POST(url, {data: {id, position: e.newIndex + 1}}); } async function initIssuePinSort() { |