Use actor type filters with search query

This commit is contained in:
Angelina Filippova 2020-10-25 01:19:14 +03:00
parent ff8a68e720
commit fff34e817a

View file

@ -183,9 +183,16 @@ export async function resendConfirmationEmail(nicknames, authHost, token) {
}
export async function searchUsers(query, filters, actorTypeFilters, authHost, token, page = 1) {
const url = actorTypeFilters.length === 0
? `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`
: actorTypeFilters.reduce((acc, filter) => {
const newAcc = acc.concat(`&actor_types[]=${filter}`)
return newAcc
}, `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}`)
return await request({
baseURL: baseName(authHost),
url: `/api/pleroma/admin/users?query=${query}&page=${page}&filters=${filters}&actor_types=${actorTypeFilters}`,
url,
method: 'get',
headers: authHeaders(token)
})