(data: any)
| 14 | import { COMMENTS } from "@/constant/article"; |
| 15 | |
| 16 | export async function addComment(data: any) { |
| 17 | try { |
| 18 | const docRef = await addDoc(collection(db, COMMENTS), { |
| 19 | ...data, |
| 20 | createdAt: new Date(), |
| 21 | }); |
| 22 | return docRef.id; |
| 23 | } catch (error) { |
| 24 | console.error("Error adding blog:", error); |
| 25 | throw error; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | export async function getComments(): Promise<any> { |
| 30 | try { |