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
|
|
@ -75,7 +75,7 @@ export default function SalesGPReport() {
|
|||
const { data: report, isLoading, error } = useQuery<SalesGPResponse>({
|
||||
queryKey: ['sales-gp', submittedFrom, submittedTo],
|
||||
queryFn: async () => {
|
||||
const res = await fetch(`/api/reports/sales-gp?from_date=${submittedFrom}&to_date=${submittedTo}`, {
|
||||
const res = await fetch(`/kitchen/api/reports/sales-gp?from_date=${submittedFrom}&to_date=${submittedTo}`, {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
})
|
||||
if (!res.ok) {
|
||||
|
|
@ -91,7 +91,7 @@ export default function SalesGPReport() {
|
|||
const { data: dishRecipes } = useQuery<DishRecipe[]>({
|
||||
queryKey: ['recipes-for-mapping', recipeSearch],
|
||||
queryFn: async () => {
|
||||
const url = `/api/recipes?recipe_type=dish${recipeSearch ? `&search=${encodeURIComponent(recipeSearch)}` : ''}`
|
||||
const url = `/kitchen/api/recipes?recipe_type=dish${recipeSearch ? `&search=${encodeURIComponent(recipeSearch)}` : ''}`
|
||||
const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` } })
|
||||
return res.json()
|
||||
},
|
||||
|
|
@ -101,7 +101,7 @@ export default function SalesGPReport() {
|
|||
// Map unmapped item to recipe
|
||||
const mapMutation = useMutation({
|
||||
mutationFn: async ({ recipeId, menuItemName, portionName }: { recipeId: number; menuItemName: string; portionName: string }) => {
|
||||
const res = await fetch(`/api/recipes/${recipeId}`, {
|
||||
const res = await fetch(`/kitchen/api/recipes/${recipeId}`, {
|
||||
method: 'PATCH',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue