|
1
|
import { Button, usePrompt } from "@medusajs/ui" |
|
2
|
|
|
3
|
export default function usePromptVerification() { |
|
4
|
const entityName = "foo-bar-baz" |
|
5
|
|
|
6
|
const dialog = usePrompt() |
|
7
|
|
|
8
|
const deleteEntity = async () => { |
|
9
|
const userHasConfirmed = await dialog({ |
|
10
|
title: "Please confirm", |
|
11
|
description: "Are you sure you want to delete this entity?", |
|
12
|
verificationText: entityName, |
|
13
|
}) |
|
14
|
if (userHasConfirmed) { |
|
15
|
// Perform Delete |
|
16
|
} |
|
17
|
} |
|
18
|
|
|
19
|
return ( |
|
20
|
<Button onClick={async () => deleteEntity()}>Delete {entityName}</Button> |
|
21
|
) |
|
22
|
} |