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
|
|
@ -144,7 +144,7 @@ export default function SearchLineItems() {
|
|||
const { data: suppliers } = useQuery<Supplier[]>({
|
||||
queryKey: ['suppliers'],
|
||||
queryFn: async () => {
|
||||
const res = await fetch('/api/suppliers/', {
|
||||
const res = await fetch('/kitchen/api/suppliers/', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch suppliers')
|
||||
|
|
@ -156,7 +156,7 @@ export default function SearchLineItems() {
|
|||
const { data: _searchSettings } = useQuery<SearchSettings>({
|
||||
queryKey: ['search-settings'],
|
||||
queryFn: async () => {
|
||||
const res = await fetch('/api/search/settings', {
|
||||
const res = await fetch('/kitchen/api/search/settings', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch search settings')
|
||||
|
|
@ -178,7 +178,7 @@ export default function SearchLineItems() {
|
|||
if (mappedFilter) params.set('mapped', mappedFilter)
|
||||
params.set('limit', '200')
|
||||
|
||||
const res = await fetch(`/api/search/line-items?${params}`, {
|
||||
const res = await fetch(`/kitchen/api/search/line-items?${params}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (!res.ok) throw new Error('Search failed')
|
||||
|
|
@ -205,7 +205,7 @@ export default function SearchLineItems() {
|
|||
|
||||
const allSuggestions: typeof aliasSuggestions = {}
|
||||
const promises = Array.from(bySupplier.entries()).map(([sid, items]) =>
|
||||
fetch('/api/ingredients/sources/alias-suggestions', {
|
||||
fetch('/kitchen/api/ingredients/sources/alias-suggestions', {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ supplier_id: sid, items }),
|
||||
|
|
@ -223,7 +223,7 @@ export default function SearchLineItems() {
|
|||
|
||||
const addDescriptionAliasMutation = useMutation({
|
||||
mutationFn: async ({ sourceId, alias }: { sourceId: number; alias: string }) => {
|
||||
const res = await fetch(`/api/ingredients/sources/${sourceId}/aliases`, {
|
||||
const res = await fetch(`/kitchen/api/ingredients/sources/${sourceId}/aliases`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
|
@ -300,7 +300,7 @@ export default function SearchLineItems() {
|
|||
}
|
||||
setIngredientSearchLoading(true)
|
||||
try {
|
||||
const res = await fetch(`/api/ingredients/suggest?description=${encodeURIComponent(query)}`, {
|
||||
const res = await fetch(`/kitchen/api/ingredients/suggest?description=${encodeURIComponent(query)}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (res.ok) setIngredientSuggestions(await res.json())
|
||||
|
|
@ -371,7 +371,7 @@ export default function SearchLineItems() {
|
|||
try {
|
||||
// Update the most recent line item's pack fields if we have one
|
||||
if (modalItem.most_recent_line_item_id && modalItem.most_recent_invoice_id) {
|
||||
await fetch(`/api/invoices/${modalItem.most_recent_invoice_id}/line-items/${modalItem.most_recent_line_item_id}`, {
|
||||
await fetch(`/kitchen/api/invoices/${modalItem.most_recent_invoice_id}/line-items/${modalItem.most_recent_line_item_id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
|
@ -399,7 +399,7 @@ export default function SearchLineItems() {
|
|||
if (costEdits.unit_price) sourceData.latest_unit_price = costEdits.unit_price
|
||||
if (modalItem.most_recent_invoice_id) sourceData.invoice_id = modalItem.most_recent_invoice_id
|
||||
|
||||
await fetch(`/api/ingredients/${selectedIngredientId}/sources`, {
|
||||
await fetch(`/kitchen/api/ingredients/${selectedIngredientId}/sources`, {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(sourceData),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue