(postId: string)
| 26 | import { Icons } from "@/components/icons" |
| 27 | |
| 28 | async 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 | |
| 44 | interface PostOperationsProps { |
| 45 | post: Pick<Post, "id" | "title"> |
no test coverage detected