mirror of
https://github.com/usatiuk/y.git
synced 2025-10-28 18:37:47 +01:00
better haters managment
This commit is contained in:
@@ -127,7 +127,11 @@ export function Haters() {
|
|||||||
<button
|
<button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
foundUArr.forEach((u) =>
|
|
||||||
|
const deluser = (who: string[]) => {
|
||||||
|
if (who.length == 0) return;
|
||||||
|
const u = who[0];
|
||||||
|
const rest = who.slice(1);
|
||||||
deleteUser(u)
|
deleteUser(u)
|
||||||
.then((e) => {
|
.then((e) => {
|
||||||
if (isError(e)) {
|
if (isError(e)) {
|
||||||
@@ -142,14 +146,17 @@ export function Haters() {
|
|||||||
"deleted user with id: " + u,
|
"deleted user with id: " + u,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
deluser(rest);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch(() => {
|
||||||
setDeleted((old) => [
|
setDeleted((old) => [
|
||||||
...old,
|
...old,
|
||||||
`error deleting user with uuid ${u}`,
|
`error deleting user with uuid ${u}`,
|
||||||
]);
|
]);
|
||||||
}),
|
});
|
||||||
);
|
};
|
||||||
|
|
||||||
|
deluser(foundUArr);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
delete all users
|
delete all users
|
||||||
|
|||||||
Reference in New Issue
Block a user