feat: add reusable confirmation dialogs for destructive actions

This commit is contained in:
cesnimda
2026-03-22 14:12:00 +01:00
parent 0863728eab
commit 758d2c6a0b
8 changed files with 107 additions and 15 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ import {
import { api } from "../api";
import { useToast } from "../toast";
import { useDialogActions } from "../dialogs";
type UserDto = {
id: string;
@@ -98,7 +99,7 @@ export default function AdminUsersPage() {
};
const remove = async (u: UserDto) => {
if (!confirmAction(`Delete user ${u.email || u.userName || u.id}?`)) return;
if (!(await confirmAction(`Delete user ${u.email || u.userName || u.id}?`, { title: "Delete user", confirmLabel: "Delete", destructive: true }))) return;
try {
await api.delete(`/users/${u.id}`);
toast("User deleted.", "info");