feat: add reusable confirmation dialogs for destructive actions
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user