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