Meal Tracker v1 - complete

This commit is contained in:
Otto
2026-03-30 13:34:53 -04:00
commit 139f756807
21 changed files with 938 additions and 0 deletions

27
client/src/utils/api.js Normal file
View File

@@ -0,0 +1,27 @@
import axios from 'axios'
const api = axios.create({
baseURL: '/api',
headers: { 'Content-Type': 'application/json' }
})
export async function getEntries() {
const { data } = await api.get('/entries')
return data
}
export async function createEntry(formData) {
const { data } = await api.post('/entries', formData, {
headers: { 'Content-Type': 'multipart/form-data' }
})
return data
}
export async function deleteEntry(id) {
await api.delete(`/entries/${id}`)
}
export async function searchFoods(query) {
const { data } = await api.get(`/foods/search?q=${encodeURIComponent(query)}`)
return data
}