Skip to content

Commit

Permalink
fix: Remove extra codeblock
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatkashyap committed Oct 16, 2024
1 parent e3ec0c7 commit 00fcddc
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions docs/data/material/components/dialogs/dialogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,30 +182,3 @@ You can create and manipulate dialogs imperatively with the [`useDialogs()`](htt
The following example demonstrates some of these features:

{{"demo": "ToolpadDialogsNoSnap.js", "defaultCodeOpen": false}}

```tsx
const handleDelete = async () => {
const id = await dialogs.prompt('Enter the ID to delete', {
okText: 'Delete',
cancelText: 'Cancel',
});

if (id) {
const deleteConfirmed = await dialogs.confirm(
`Are you sure you want to delete "${id}"?`,
);
if (deleteConfirmed) {
try {
setIsDeleting(true);
await mockApiDelete(id);
dialogs.alert('Deleted!');
} catch (error) {
const message = error instanceof Error ? error.message : 'Unknown error';
await dialogs.open(MyCustomDialog, { id, error: message });
} finally {
setIsDeleting(false);
}
}
}
};
```

0 comments on commit 00fcddc

Please sign in to comment.