mirror of
https://github.com/usatiuk/y.git
synced 2025-10-28 10:37:47 +01:00
better haters managment
This commit is contained in:
@@ -9,7 +9,17 @@
|
||||
.tools {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-width: 10rem;
|
||||
max-width: 20rem;
|
||||
|
||||
> * {
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
.delResults {
|
||||
margin-top: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.found {
|
||||
|
||||
@@ -109,7 +109,10 @@ export function Haters() {
|
||||
author: p.authorUsername,
|
||||
});
|
||||
});
|
||||
const uuidToUsername: Record<string, string> = {};
|
||||
|
||||
data.persons.forEach((p) => (uuidToUsername[p.uuid] = p.username));
|
||||
console.log(uuidToUsername);
|
||||
console.log(foundU);
|
||||
|
||||
const foundUArr = Array.from(foundU);
|
||||
@@ -137,13 +140,14 @@ export function Haters() {
|
||||
if (isError(e)) {
|
||||
setDeleted((old) => [
|
||||
...old,
|
||||
`error deleting user with uuid ${u}: ` +
|
||||
`error deleting user ${uuidToUsername[u]}: ` +
|
||||
e.errors.join(" "),
|
||||
]);
|
||||
} else {
|
||||
setDeleted((old) => [
|
||||
...old,
|
||||
"deleted user with id: " + u,
|
||||
"deleted user: " +
|
||||
uuidToUsername[u],
|
||||
]);
|
||||
}
|
||||
deluser(rest);
|
||||
@@ -151,7 +155,7 @@ export function Haters() {
|
||||
.catch(() => {
|
||||
setDeleted((old) => [
|
||||
...old,
|
||||
`error deleting user with uuid ${u}`,
|
||||
`error deleting user ${uuidToUsername[u]}`,
|
||||
]);
|
||||
});
|
||||
};
|
||||
@@ -159,9 +163,9 @@ export function Haters() {
|
||||
deluser(foundUArr);
|
||||
}}
|
||||
>
|
||||
delete all users
|
||||
delete all found users
|
||||
</button>
|
||||
<div>
|
||||
<div className={"delResults"}>
|
||||
{deleted.map((d) => (
|
||||
<span>{d}</span>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user