feat: stabilization + recipe edit/create UI

This commit is contained in:
clawd
2026-02-18 09:55:39 +00:00
commit ee452efa6a
75 changed files with 15160 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
import { apiFetch } from './client'
export interface ShoppingItem {
id: string
name: string
amount?: number
unit?: string
checked: boolean
recipe_id?: string
recipe_title?: string
created_at?: string
}
export interface ShoppingGroup {
recipe_title: string
recipe_id?: string
items: ShoppingItem[]
}
export function fetchShopping() {
return apiFetch<ShoppingGroup[]>('/shopping')
}
export function addFromRecipe(recipeId: string) {
return apiFetch<{ added: number }>(`/shopping/from-recipe/${recipeId}`, { method: 'POST' })
}
export function addCustomItem(item: { name: string; amount?: number; unit?: string }) {
return apiFetch<ShoppingItem>('/shopping', {
method: 'POST',
body: JSON.stringify(item),
})
}
export function toggleCheck(id: string) {
return apiFetch<ShoppingItem>(`/shopping/${id}/check`, { method: 'PATCH' })
}
export function deleteItem(id: string) {
return apiFetch<void>(`/shopping/${id}`, { method: 'DELETE' })
}
export function deleteChecked() {
return apiFetch<void>('/shopping/checked', { method: 'DELETE' })
}