feat(config): phase 7 — drop /ims basePath, update all hardcoded paths, refresh env spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,7 +153,7 @@ export function SiteZoneManager({ sites }: Props) {
|
||||
<span>{z.name}</span>
|
||||
<div className="flex items-center gap-3">
|
||||
<a
|
||||
href={`/ims/report?zone=${z.qr_code_token}`}
|
||||
href={`/report?zone=${z.qr_code_token}`}
|
||||
target="_blank"
|
||||
className="text-xs text-blue-600 hover:underline"
|
||||
>
|
||||
|
||||
@@ -127,7 +127,7 @@ export function TruckManager({ trucks }: Props) {
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<a
|
||||
href={`/ims/report?truck_id=${tk.id}`}
|
||||
href={`/report?truck_id=${tk.id}`}
|
||||
target="_blank"
|
||||
className="text-xs text-blue-600 hover:underline"
|
||||
>
|
||||
|
||||
@@ -51,7 +51,7 @@ export function UserManager({ users, sites }: Props) {
|
||||
const deleteUser = async (id: string) => {
|
||||
setBusyId(id)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/admin/users?id=${encodeURIComponent(id)}`, { method: 'DELETE' })
|
||||
const res = await fetch(`/api/admin/users?id=${encodeURIComponent(id)}`, { method: 'DELETE' })
|
||||
setBusyId(null)
|
||||
setConfirmDeleteId(null)
|
||||
if (!res.ok) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export function CapaOwnerActions({ capaId, currentStatus }: Props) {
|
||||
async function updateStatus(status: string) {
|
||||
setLoading(true)
|
||||
try {
|
||||
const res = await fetch(`/ims/api/capa/${capaId}`, {
|
||||
const res = await fetch(`/api/capa/${capaId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ status }),
|
||||
|
||||
@@ -17,7 +17,7 @@ export function CapaOwnerNotesForm({ capaId, initialNotes }: Props) {
|
||||
setSaving(true)
|
||||
setSaved(false)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/capa/${capaId}`, {
|
||||
const res = await fetch(`/api/capa/${capaId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ owner_notes: notes }),
|
||||
|
||||
@@ -16,7 +16,7 @@ export function CloseCapaButton({ capaId }: Props) {
|
||||
if (!confirm('Close this CAPA? This marks it as fully resolved.')) return
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/capa/${capaId}`, {
|
||||
const res = await fetch(`/api/capa/${capaId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ status: 'closed' }),
|
||||
|
||||
@@ -23,7 +23,7 @@ export function VerifyForm({ capaId }: Props) {
|
||||
}
|
||||
setSaving(true)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/capa/${capaId}/verify`, {
|
||||
const res = await fetch(`/api/capa/${capaId}/verify`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ verdict, reopen_reason: reopenReason || null }),
|
||||
|
||||
@@ -28,7 +28,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
|
||||
useEffect(() => {
|
||||
if (!isClosed) return
|
||||
fetch(`/ims/api/incidents/${incidentId}/addenda`)
|
||||
fetch(`/api/incidents/${incidentId}/addenda`)
|
||||
.then(r => (r.ok ? r.json() : Promise.reject()))
|
||||
.then((data: Addendum[]) => setAddenda(Array.isArray(data) ? data : []))
|
||||
.catch(() => {})
|
||||
@@ -38,7 +38,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
if (!confirm('Close this incident? The record will be locked — only addenda can be added afterwards.')) return
|
||||
setBusy(true)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/incidents/${incidentId}/close`, { method: 'POST' })
|
||||
const res = await fetch(`/api/incidents/${incidentId}/close`, { method: 'POST' })
|
||||
setBusy(false)
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}))
|
||||
@@ -53,7 +53,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
if (!text) return
|
||||
setBusy(true)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/incidents/${incidentId}/addenda`, {
|
||||
const res = await fetch(`/api/incidents/${incidentId}/addenda`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ body: text }),
|
||||
@@ -65,7 +65,7 @@ export function ClosurePanel({ incidentId, status, canClose, canAddAddenda }: Pr
|
||||
return
|
||||
}
|
||||
setDraft('')
|
||||
const list = await fetch(`/ims/api/incidents/${incidentId}/addenda`).then(r => r.json()).catch(() => [])
|
||||
const list = await fetch(`/api/incidents/${incidentId}/addenda`).then(r => r.json()).catch(() => [])
|
||||
setAddenda(Array.isArray(list) ? list : [])
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
async function getAiDraft() {
|
||||
setAiDraftLoading(true)
|
||||
try {
|
||||
const res = await fetch(`/ims/api/incidents/${incidentId}/ai/rca-draft`, { method: 'POST' })
|
||||
const res = await fetch(`/api/incidents/${incidentId}/ai/rca-draft`, { method: 'POST' })
|
||||
if (!res.ok) return
|
||||
const draft = await res.json() as {
|
||||
five_why_steps: Array<{ why: string; answer: string }>
|
||||
@@ -106,13 +106,13 @@ export function InvestigationForm({ incidentId, existingInvestigationId }: Props
|
||||
|
||||
let res: Response
|
||||
if (existingInvestigationId) {
|
||||
res = await fetch(`/ims/api/incidents/${incidentId}/investigation`, {
|
||||
res = await fetch(`/api/incidents/${incidentId}/investigation`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ...payload, investigation_id: existingInvestigationId, complete }),
|
||||
})
|
||||
} else {
|
||||
res = await fetch(`/ims/api/incidents/${incidentId}/investigation`, {
|
||||
res = await fetch(`/api/incidents/${incidentId}/investigation`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
|
||||
@@ -31,7 +31,7 @@ export function SimilarIncidentsPanel({ incidentId }: Props) {
|
||||
const [error, setError] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
fetch(`/ims/api/incidents/${incidentId}/similar`)
|
||||
fetch(`/api/incidents/${incidentId}/similar`)
|
||||
.then(r => {
|
||||
if (!r.ok) throw new Error('failed')
|
||||
return r.json()
|
||||
|
||||
@@ -42,7 +42,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
||||
setAiLoading(true)
|
||||
setAiRationale(null)
|
||||
try {
|
||||
const res = await fetch(`/ims/api/incidents/${incidentId}/ai/triage-suggest`, { method: 'POST' })
|
||||
const res = await fetch(`/api/incidents/${incidentId}/ai/triage-suggest`, { method: 'POST' })
|
||||
if (!res.ok) return
|
||||
const data = await res.json() as {
|
||||
severity: number
|
||||
@@ -69,7 +69,7 @@ export function TriageForm({ incidentId, currentSeverity }: Props) {
|
||||
e.preventDefault()
|
||||
setSaving(true)
|
||||
setError(null)
|
||||
const res = await fetch(`/ims/api/incidents/${incidentId}/triage`, {
|
||||
const res = await fetch(`/api/incidents/${incidentId}/triage`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user