1
0
Fork 0
mirror of synced 2024-09-30 00:57:16 +13:00

fixed issue bulkDelete losing context because of a forEach loop

This commit is contained in:
NEOLPAR 2022-07-14 14:15:12 +01:00
parent 819ce4e360
commit 835c4e390d

View file

@ -148,12 +148,13 @@ export const destroy = async (ctx: any) => {
export const bulkDelete = async (ctx: any) => {
const { userIds } = ctx.request.body
let deleted = 0
userIds.forEach(async (id: any) => {
for (const id of userIds) {
await users.destroy(id, ctx.user)
deleted++
})
}
ctx.body = {
message: `${deleted} user(s) deleted`,
}