Migrate all kitchen frontend fetch calls to /kitchen/api/ prefix (B5b)
All archive components were calling fetch('/api/...') directly. Replaced
all occurrences of /api/ URLs (string literals, template literals,
window.open, src attributes) with /kitchen/api/ across 37 source files.
The central axios instance in api.ts was already correct.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ecd63fc65f
commit
9905d0e0dd
51 changed files with 453 additions and 453 deletions
|
|
@ -123,7 +123,7 @@ export default function CostDistributionModal({ isOpen, onClose, onSaved, invoic
|
|||
if (distributionId) {
|
||||
// Load existing distribution
|
||||
setLoading(true)
|
||||
fetch(`/api/cost-distributions/${distributionId}`, {
|
||||
fetch(`/kitchen/api/cost-distributions/${distributionId}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
.then(r => { if (!r.ok) throw new Error('Failed to load distribution'); return r.json() })
|
||||
|
|
@ -136,7 +136,7 @@ export default function CostDistributionModal({ isOpen, onClose, onSaved, invoic
|
|||
} else if (invoiceId) {
|
||||
// Load invoice availability
|
||||
setLoading(true)
|
||||
fetch(`/api/cost-distributions/invoice/${invoiceId}/availability`, {
|
||||
fetch(`/kitchen/api/cost-distributions/invoice/${invoiceId}/availability`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
.then(r => { if (!r.ok) throw new Error('Failed to load invoice data'); return r.json() })
|
||||
|
|
@ -276,7 +276,7 @@ export default function CostDistributionModal({ isOpen, onClose, onSaved, invoic
|
|||
body.start_date = startDate
|
||||
}
|
||||
|
||||
const res = await fetch('/api/cost-distributions/', {
|
||||
const res = await fetch('/kitchen/api/cost-distributions/', {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
|
|
@ -300,7 +300,7 @@ export default function CostDistributionModal({ isOpen, onClose, onSaved, invoic
|
|||
if (!token || !distributionId) return
|
||||
setSaving(true)
|
||||
try {
|
||||
const res = await fetch(`/api/cost-distributions/${distributionId}`, {
|
||||
const res = await fetch(`/kitchen/api/cost-distributions/${distributionId}`, {
|
||||
method: 'PUT',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ notes }),
|
||||
|
|
@ -320,7 +320,7 @@ export default function CostDistributionModal({ isOpen, onClose, onSaved, invoic
|
|||
if (!confirm('Are you sure you want to cancel this distribution? This will remove all scheduled entries.')) return
|
||||
setDeleting(true)
|
||||
try {
|
||||
const res = await fetch(`/api/cost-distributions/${distributionId}`, {
|
||||
const res = await fetch(`/kitchen/api/cost-distributions/${distributionId}`, {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
|
|
@ -343,7 +343,7 @@ export default function CostDistributionModal({ isOpen, onClose, onSaved, invoic
|
|||
try {
|
||||
const body: any = { entry_date: settleDate }
|
||||
if (!settleAll && settleAmount) body.amount = parseFloat(settleAmount)
|
||||
const res = await fetch(`/api/cost-distributions/${distributionId}/settle-early`, {
|
||||
const res = await fetch(`/kitchen/api/cost-distributions/${distributionId}/settle-early`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue