Updated members bulk delete to work with filters/paid/search

no issue

- use the same API query param generation for bulk delete requests as we use for the primary members list so that delete affects the same list that is visible/selected
This commit is contained in:
Kevin Ansfield 2020-06-25 22:44:24 +01:00
parent 23537355b6
commit 2326e3d616

View File

@ -298,7 +298,14 @@ export default class MembersController extends Controller {
@task({drop: true})
*deleteMembersTask() {
let query = new URLSearchParams({all: true});
let {label, paidParam, searchParam} = this;
let filter = label ? `label:${label}` : '';
let paidQuery = paidParam ? {paid: paidParam} : {};
let searchQuery = searchParam ? {search: searchParam} : {};
let allQuery = !label && !paidParam && !searchParam ? {all: true} : {};
let query = new URLSearchParams(Object.assign({}, {filter}, paidQuery, searchQuery, allQuery));
let url = `${this.ghostPaths.url.api('members')}?${query}`;
// response contains details of which members failed to be deleted