fix: replace API calls to api.delete with api.del

This commit is contained in:
Julian Lam
2022-12-16 14:22:49 -05:00
parent c4e2b4e87f
commit 81a4ee18c8
5 changed files with 8 additions and 8 deletions

View File

@@ -114,7 +114,7 @@ define('admin/manage/admins-mods', [
bootbox.confirm('[[admin/manage/users:alerts.confirm-remove-moderator]]', function (confirm) {
if (confirm) {
api.delete(`/categories/${cid}/moderator/${uid}`, {}, function (err) {
api.del(`/categories/${cid}/moderator/${uid}`, {}, function (err) {
if (err) {
return alerts.error(err);
}

View File

@@ -283,7 +283,7 @@ define('forum/chats', [
modal.on('click', '[data-action="kick"]', function () {
const uid = parseInt(this.getAttribute('data-uid'), 10);
api.delete(`/chats/${roomId}/users/${uid}`, {}).then((body) => {
api.del(`/chats/${roomId}/users/${uid}`, {}).then((body) => {
Chats.refreshParticipantsList(roomId, modal, body);
}).catch(alerts.error);
});
@@ -297,7 +297,7 @@ define('forum/chats', [
message: '<p>[[modules:chat.leave-prompt]]</p><p class="form-text">[[modules:chat.leave-help]]</p>',
callback: function (ok) {
if (ok) {
api.delete(`/chats/${roomId}/users/${app.user.uid}`, {}).then(() => {
api.del(`/chats/${roomId}/users/${app.user.uid}`, {}).then(() => {
// Return user to chats page. If modal, close modal.
const modal = buttonEl.parents('.chat-modal');
if (modal.length) {
@@ -399,7 +399,7 @@ define('forum/chats', [
Chats.leave = function (el) {
const roomId = el.attr('data-roomid');
api.delete(`/chats/${roomId}/users/${app.user.uid}`, {}).then(() => {
api.del(`/chats/${roomId}/users/${app.user.uid}`, {}).then(() => {
if (parseInt(roomId, 10) === parseInt(ajaxify.data.roomId, 10)) {
ajaxify.go('user/' + ajaxify.data.userslug + '/chats');
} else {

View File

@@ -195,7 +195,7 @@ define('forum/chats/messages', [
return;
}
api.delete(`/chats/${roomId}/messages/${messageId}`, {}).then(() => {
api.del(`/chats/${roomId}/messages/${messageId}`, {}).then(() => {
components.get('chat/message', messageId).toggleClass('deleted', true);
}).catch(alerts.error);
});

View File

@@ -50,7 +50,7 @@ define('forum/flags/detail', [
const datetime = parseInt(this.closest('[data-datetime]').getAttribute('data-datetime'), 10);
bootbox.confirm('[[flags:delete-note-confirm]]', function (ok) {
if (ok) {
api.delete(`/flags/${ajaxify.data.flagId}/notes/${datetime}`, {}).then((payload) => {
api.del(`/flags/${ajaxify.data.flagId}/notes/${datetime}`, {}).then((payload) => {
alerts.success('[[flags:note-deleted]]');
Detail.reloadNotes(payload.notes);
Detail.reloadHistory(payload.history);
@@ -126,7 +126,7 @@ define('forum/flags/detail', [
case 'delete-flag': {
bootbox.confirm('[[flags:delete-flag-confirm]]', function (ok) {
if (ok) {
api.delete(`/flags/${ajaxify.data.flagId}`, {}).then(() => {
api.del(`/flags/${ajaxify.data.flagId}`, {}).then(() => {
alerts.success('[[flags:flag-deleted]]');
ajaxify.go('flags');
}).catch(alerts.error);

View File

@@ -52,7 +52,7 @@ define('forum/topic/delete-posts', [
function deletePosts(btn, route) {
btn.attr('disabled', true);
Promise.all(postSelect.pids.map(pid => api.delete(route(pid), {})))
Promise.all(postSelect.pids.map(pid => api.del(route(pid), {})))
.then(closeModal)
.catch(alerts.error)
.finally(() => {