feat: Add 'delete user' option for admins

This commit is contained in:
Tom Moor
2023-05-02 20:14:12 -04:00
parent 3d6a875631
commit 9918b9bf13
4 changed files with 70 additions and 5 deletions

View File

@@ -58,6 +58,31 @@ export function UserChangeToMemberDialog({ user, onSubmit }: Props) {
);
}
export function UserDeleteDialog({ user, onSubmit }: Props) {
const { t } = useTranslation();
const handleSubmit = async () => {
await user.delete();
onSubmit();
};
return (
<ConfirmationDialog
onSubmit={handleSubmit}
submitText={t("I understand, delete")}
savingText={`${t("Deleting")}`}
danger
>
{t(
"Are you sure you want to permanently delete {{ userName }}? This operation is unrecoverable, consider suspending the user instead.",
{
userName: user.name,
}
)}
</ConfirmationDialog>
);
}
export function UserChangeToAdminDialog({ user, onSubmit }: Props) {
const { t } = useTranslation();
const { users } = useStores();