From cbfd6fb9965a9694a60be735614cd1d0380af22b Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 17 Mar 2026 02:43:56 +0000 Subject: [PATCH] =?UTF-8?q?fix(web):=20conversation=20DELETE=20=E2=80=94?= =?UTF-8?q?=20resolve=20Failed=20to=20fetch=20TypeError=20(#204)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jason Woltje Co-committed-by: Jason Woltje --- apps/gateway/src/main.ts | 1 + apps/web/src/app/(dashboard)/chat/page.tsx | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/gateway/src/main.ts b/apps/gateway/src/main.ts index d44ee18..b5b4932 100644 --- a/apps/gateway/src/main.ts +++ b/apps/gateway/src/main.ts @@ -40,6 +40,7 @@ async function bootstrap(): Promise { app.enableCors({ origin: process.env['GATEWAY_CORS_ORIGIN'] ?? 'http://localhost:3000', credentials: true, + methods: ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], }); await app.register(helmet as never, { contentSecurityPolicy: false }); diff --git a/apps/web/src/app/(dashboard)/chat/page.tsx b/apps/web/src/app/(dashboard)/chat/page.tsx index a04867d..68bea36 100644 --- a/apps/web/src/app/(dashboard)/chat/page.tsx +++ b/apps/web/src/app/(dashboard)/chat/page.tsx @@ -151,11 +151,15 @@ export default function ChatPage(): React.ReactElement { const handleDelete = useCallback( async (id: string) => { - await api(`/api/conversations/${id}`, { method: 'DELETE' }); - setConversations((prev) => prev.filter((c) => c.id !== id)); - if (activeId === id) { - setActiveId(null); - setMessages([]); + try { + await api(`/api/conversations/${id}`, { method: 'DELETE' }); + setConversations((prev) => prev.filter((c) => c.id !== id)); + if (activeId === id) { + setActiveId(null); + setMessages([]); + } + } catch (err) { + console.error('[ChatPage] Failed to delete conversation:', err); } }, [activeId],