feat: added DELETE /api/v1/categories/:cid route

This commit is contained in:
Julian Lam
2020-04-03 11:37:41 -04:00
parent e942ad8101
commit 3072de4812
4 changed files with 27 additions and 14 deletions

View File

@@ -107,17 +107,18 @@ define('admin/manage/category', [
});
}, 1000);
socket.emit('admin.categories.purge', ajaxify.data.category.cid, function (err) {
if (err) {
return app.alertError(err.message);
}
$.ajax({
url: config.relative_path + '/api/v1/categories/' + ajaxify.data.category.cid,
method: 'delete',
}).done(function () {
if (intervalId) {
clearInterval(intervalId);
}
modal.modal('hide');
app.alertSuccess('[[admin/manage/categories:alert.purge-success]]');
ajaxify.go('admin/manage/categories');
}).fail(function (ev) {
app.alertError(ev.responseJSON.status.message);
});
return false;