Even though `type` is an alias for `method`, we have custom logic in `/discourse/lib/ajax` that checks only `type`, and ~200 other ajax calls in the codebase already use `type` param.
22 lines
569 B
JavaScript
22 lines
569 B
JavaScript
import { ajax } from "discourse/lib/ajax";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
|
|
function exportEntityByType(type, entity, args) {
|
|
return ajax("/export_csv/export_entity.json", {
|
|
type: "POST",
|
|
data: { entity, args }
|
|
});
|
|
}
|
|
|
|
export function exportUserArchive() {
|
|
return exportEntityByType("user", "user_archive")
|
|
.then(function() {
|
|
bootbox.alert(I18n.t("user.download_archive.success"));
|
|
})
|
|
.catch(popupAjaxError);
|
|
}
|
|
|
|
export function exportEntity(entity, args) {
|
|
return exportEntityByType("admin", entity, args);
|
|
}
|