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
@@ -17,6 +17,7 @@ type UserDto = {
export default function UserManagementCard() {
const { toast } = useToast();
const { confirmAction } = useDialogActions();
const token = getAuthToken();
const [supported, setSupported] = useState<boolean | null>(null);
@@ -150,7 +151,7 @@ export default function UserManagementCard() {
variant="outlined"
color="error"
onClick={async () => {
if (!window.confirm("Delete this user?")) return;
if (!(await confirmAction("Delete this user?", { title: "Delete user", confirmLabel: "Delete", destructive: true }))) return;
try {
await api.delete(`/users/${u.id}`);
toast("User deleted.", "info");