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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FFDuBhMKvoWjrWT3ZnGmmr
This commit is contained in:
2026-07-11 21:26:18 +08:00
co-authored by Claude Sonnet 4.6
parent 448ea4857a
commit e4d1da033d
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ export function CapaForm({ incidentId, users }: Props) {
} }
setSaving(true) setSaving(true)
setError(null) setError(null)
const res = await fetch('/api/capa', { const res = await fetch('/ims/api/capa', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
+2 -2
View File
@@ -98,7 +98,7 @@ export function ReportForm({ zoneToken }: Props) {
if (!overrideQuality) { if (!overrideQuality) {
try { try {
const qcRes = await fetch('/api/incidents/ai/quality-check', { const qcRes = await fetch('/ims/api/incidents/ai/quality-check', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({
@@ -136,7 +136,7 @@ export function ReportForm({ zoneToken }: Props) {
} }
files.forEach(f => fd.append('files', f)) 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() const data = await res.json()
if (!res.ok) { if (!res.ok) {
+1 -1
View File
@@ -25,7 +25,7 @@ export function ApiKeyForm({ settings }: Props) {
setSaving(s => ({ ...s, [key]: true })) setSaving(s => ({ ...s, [key]: true }))
setResults(r => ({ ...r, [key]: undefined as never })) setResults(r => ({ ...r, [key]: undefined as never }))
try { try {
const res = await fetch('/api/settings', { const res = await fetch('/ims/api/settings', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ key, value: values[key] }), body: JSON.stringify({ key, value: values[key] }),