From e4d1da033db1ca7d87fefbb6045643848e32c879 Mon Sep 17 00:00:00 2001 From: weeihan Date: Sat, 11 Jul 2026 21:26:18 +0800 Subject: [PATCH] fix: prefix all client-side fetch calls with /ims basePath Client components were calling fetch('/api/...') without the /ims prefix, causing 404s in production where Next.js serves under basePath: '/ims'. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr --- components/capa/capa-form.tsx | 2 +- components/incidents/report-form.tsx | 4 ++-- components/settings/api-key-form.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/capa/capa-form.tsx b/components/capa/capa-form.tsx index 66d9030..1fc8ec5 100644 --- a/components/capa/capa-form.tsx +++ b/components/capa/capa-form.tsx @@ -39,7 +39,7 @@ export function CapaForm({ incidentId, users }: Props) { } setSaving(true) setError(null) - const res = await fetch('/api/capa', { + const res = await fetch('/ims/api/capa', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ diff --git a/components/incidents/report-form.tsx b/components/incidents/report-form.tsx index 531eb66..732a442 100644 --- a/components/incidents/report-form.tsx +++ b/components/incidents/report-form.tsx @@ -98,7 +98,7 @@ export function ReportForm({ zoneToken }: Props) { if (!overrideQuality) { try { - const qcRes = await fetch('/api/incidents/ai/quality-check', { + const qcRes = await fetch('/ims/api/incidents/ai/quality-check', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -136,7 +136,7 @@ export function ReportForm({ zoneToken }: Props) { } files.forEach(f => fd.append('files', f)) - const res = await fetch('/api/incidents', { method: 'POST', body: fd }) + const res = await fetch('/ims/api/incidents', { method: 'POST', body: fd }) const data = await res.json() if (!res.ok) { diff --git a/components/settings/api-key-form.tsx b/components/settings/api-key-form.tsx index eb71402..7e0d97d 100644 --- a/components/settings/api-key-form.tsx +++ b/components/settings/api-key-form.tsx @@ -25,7 +25,7 @@ export function ApiKeyForm({ settings }: Props) { setSaving(s => ({ ...s, [key]: true })) setResults(r => ({ ...r, [key]: undefined as never })) try { - const res = await fetch('/api/settings', { + const res = await fetch('/ims/api/settings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ key, value: values[key] }),