project/medusa-foundation-audit
| 1 | import { Button, usePrompt } from "@medusajs/ui" |
| 2 | |
| 3 | export default function usePromptDemo() { |
| 4 | const dialog = usePrompt() |
| 5 | |
| 6 | const deleteEntity = async () => { |
| 7 | const userHasConfirmed = await dialog({ |
| 8 | title: "Please confirm", |
| 9 | description: "Are you sure you want to do this?", |
| 10 | }) |
| 11 | if (userHasConfirmed) { |
| 12 | // Perform Delete |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | return <Button onClick={async () => deleteEntity()}>Delete Entity</Button> |
| 17 | } |