FEAT-1: add typed gerbils/lookups API + useApi/useMutation hooks

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-05 23:52:39 +02:00
parent e04b69ce49
commit f162ef4fed
4 changed files with 159 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
/** Typed API functions for the Tiere (Rennmäuse) resource. */
import { api, resources } from './client'
import { toQueryString, type GridifyQuery } from './gridify'
import type { CreateGerbil, Gerbil, Paged, UpdateGerbil } from './types'
export function listGerbils(query: GridifyQuery): Promise<Paged<Gerbil>> {
return api.get<Paged<Gerbil>>(`${resources.gerbils}${toQueryString(query)}`)
}
export function getGerbil(id: string): Promise<Gerbil> {
return api.get<Gerbil>(`${resources.gerbils}/${id}`)
}
export function createGerbil(body: CreateGerbil): Promise<Gerbil> {
return api.post<Gerbil>(resources.gerbils, body)
}
export function updateGerbil(id: string, body: UpdateGerbil): Promise<Gerbil> {
return api.put<Gerbil>(`${resources.gerbils}/${id}`, body)
}
export function deleteGerbil(id: string): Promise<void> {
return api.delete(`${resources.gerbils}/${id}`)
}