mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-26 10:42:16 -06:00
@@ -26,16 +26,19 @@ const DeleteProductRender: React.FC<DeleteProductRenderProps> = ({
|
||||
}) => {
|
||||
const router = useRouter();
|
||||
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
|
||||
const [isDeleting, setIsDeleting] = useState(false);
|
||||
|
||||
const handleDeleteProduct = async () => {
|
||||
try {
|
||||
setIsDeleting(true);
|
||||
const deletedProduct = await deleteProductAction(environmentId, userId, product.id);
|
||||
|
||||
if (!!deletedProduct?.id) {
|
||||
toast.success("Product deleted successfully.");
|
||||
router.push("/");
|
||||
}
|
||||
setIsDeleting(false);
|
||||
} catch (err) {
|
||||
setIsDeleting(false);
|
||||
toast.error("Could not delete product.");
|
||||
setIsDeleteDialogOpen(false);
|
||||
}
|
||||
@@ -77,6 +80,7 @@ const DeleteProductRender: React.FC<DeleteProductRenderProps> = ({
|
||||
product.name,
|
||||
30
|
||||
)}"? This action cannot be undone.`}
|
||||
isDeleting={isDeleting}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user