实现博客评论

This commit is contained in:
2025-06-07 15:19:43 +08:00
parent 2627c85ec5
commit e646b20456
9 changed files with 123 additions and 23 deletions

View File

@@ -1,9 +1,12 @@
import { BlogComment } from "@/lib/types/blogComment";
import fetcher from "../fetcher";
export async function createComment(blogId: string, content: string) {
export async function createComment(blogId: string, content: string, parentId?: string) {
return fetcher<BlogComment>(`/api/blog/${blogId}/comment`, {
method: 'POST',
body: JSON.stringify({ content }),
body: JSON.stringify({
content,
parentId: parentId || null,
}),
});
}