feat(frontend): API layer + stores Pinia
Ajoute le client Axios, les modules API (gardens, varieties, plantings, tasks) et les stores Pinia correspondants. Corrige tsconfig.json pour inclure vite/client et DOM.Iterable. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
23
frontend/src/api/varieties.ts
Normal file
23
frontend/src/api/varieties.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import client from './client'
|
||||
|
||||
export interface PlantVariety {
|
||||
id?: number
|
||||
nom_commun: string
|
||||
nom_botanique?: string
|
||||
variete?: string
|
||||
famille?: string
|
||||
type_plante?: string
|
||||
besoin_eau?: string
|
||||
espacement_cm?: number
|
||||
plantation_mois?: string
|
||||
recolte_mois?: string
|
||||
notes?: string
|
||||
}
|
||||
|
||||
export const varietiesApi = {
|
||||
list: () => client.get<PlantVariety[]>('/api/varieties').then(r => r.data),
|
||||
get: (id: number) => client.get<PlantVariety>(`/api/varieties/${id}`).then(r => r.data),
|
||||
create: (v: Partial<PlantVariety>) => client.post<PlantVariety>('/api/varieties', v).then(r => r.data),
|
||||
update: (id: number, v: Partial<PlantVariety>) => client.put<PlantVariety>(`/api/varieties/${id}`, v).then(r => r.data),
|
||||
delete: (id: number) => client.delete(`/api/varieties/${id}`),
|
||||
}
|
||||
Reference in New Issue
Block a user