Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 1x 1x 1x 1x | import api from './api'
export interface Preset {
id: string
name: string
emoji: string
itemCount: number
system: boolean
createdAt: string
}
export interface PresetItem {
id: string
name: string
quantity: number | null
quantityUnit: string | null
price: number | null
imageUrl: string | null
}
export const presetService = {
getAll: (): Promise<Preset[]> =>
api.get<Preset[]>('/presets').then(r => r.data),
getItems: (presetId: string): Promise<PresetItem[]> =>
api.get<PresetItem[]>(`/presets/${presetId}/items`).then(r => r.data),
create: (name: string, emoji: string, fromListId: string): Promise<Preset> =>
api.post<Preset>('/presets', { name, emoji, fromListId }).then(r => r.data),
delete: (presetId: string): Promise<void> =>
api.delete(`/presets/${presetId}`).then(() => {}),
}
|