MCPcopy
hub / github.com/shadcn-ui/taxonomy / deletePost

Function deletePost

components/post-operations.tsx:28–42  ·  view source on GitHub ↗
(postId: string)

Source from the content-addressed store, hash-verified

26import { Icons } from "@/components/icons"
27
28async function deletePost(postId: string) {
29 const response = await fetch(`/api/posts/${postId}`, {
30 method: "DELETE",
31 })
32
33 if (!response?.ok) {
34 toast({
35 title: "Something went wrong.",
36 description: "Your post was not deleted. Please try again.",
37 variant: "destructive",
38 })
39 }
40
41 return true
42}
43
44interface PostOperationsProps {
45 post: Pick<Post, "id" | "title">

Callers 1

PostOperationsFunction · 0.85

Calls 1

toastFunction · 0.90

Tested by

no test coverage detected