From a4d2466bd1491687f3190af622aef51e93760f0a Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Wed, 5 Nov 2025 03:54:58 +0000 Subject: [PATCH] Prettier format pending files --- client/contexts/AuthContext.tsx | 21 +++++++++++-------- server/index.ts | 37 ++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 572641fe..a05a8dee 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -560,15 +560,18 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ if (data.user) { try { // Try to send via custom SMTP server - const verifyResponse = await fetch("/api/auth/send-verification-email", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ - email, - redirectTo, - fullName: metadata.full_name || null, - }), - }); + const verifyResponse = await fetch( + "/api/auth/send-verification-email", + { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + email, + redirectTo, + fullName: metadata.full_name || null, + }), + }, + ); const verifyPayload = await verifyResponse.json().catch(() => ({})); diff --git a/server/index.ts b/server/index.ts index 2e1224b0..995823ee 100644 --- a/server/index.ts +++ b/server/index.ts @@ -541,17 +541,34 @@ export function createServer() { if (!payload.author_id) { return res.status(400).json({ error: "author_id is required" }); } - if (!payload.title || typeof payload.title !== "string" || !payload.title.trim()) { - return res.status(400).json({ error: "title is required and must be a non-empty string" }); + if ( + !payload.title || + typeof payload.title !== "string" || + !payload.title.trim() + ) { + return res + .status(400) + .json({ error: "title is required and must be a non-empty string" }); } - if (!payload.content || typeof payload.content !== "string" || !payload.content.trim()) { - return res.status(400).json({ error: "content is required and must be a non-empty string" }); + if ( + !payload.content || + typeof payload.content !== "string" || + !payload.content.trim() + ) { + return res + .status(400) + .json({ + error: "content is required and must be a non-empty string", + }); } // Validate author_id is a valid UUID format - const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; + const uuidRegex = + /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; if (!uuidRegex.test(String(payload.author_id))) { - return res.status(400).json({ error: "author_id must be a valid UUID" }); + return res + .status(400) + .json({ error: "author_id must be a valid UUID" }); } try { @@ -573,7 +590,9 @@ export function createServer() { title: String(payload.title).trim(), content: String(payload.content).trim(), category: payload.category ? String(payload.category).trim() : null, - tags: Array.isArray(payload.tags) ? payload.tags.map((t: any) => String(t).trim()) : [], + tags: Array.isArray(payload.tags) + ? payload.tags.map((t: any) => String(t).trim()) + : [], is_published: payload.is_published ?? true, }) .select() @@ -585,7 +604,9 @@ export function createServer() { message: error.message, details: (error as any).details, }); - return res.status(500).json({ error: error.message || "Failed to create post" }); + return res + .status(500) + .json({ error: error.message || "Failed to create post" }); } res.json(data);