MCPcopy Create free account
hub / github.com/Hazrat-Ali9/Problem-Solving-Frontend / addBlog

Function addBlog

lib/firebase/blogs.ts:19–30  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

17import { BLOGS, COMMENTS } from "@/constant/article";
18
19export async function addBlog(data: any) {
20 try {
21 const docRef = await addDoc(collection(db, BLOGS), {
22 ...data,
23 createdAt: new Date(),
24 });
25 return docRef.id;
26 } catch (error) {
27 console.error("Error adding blog:", error);
28 throw error;
29 }
30}
31
32export async function getBlogs(max?: number, lastDoc?: any): Promise<any> {
33 try {

Callers 1

handleSubmitFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected