/* * ${Name} API client snippet. * * Paste this ${name}Api block into frontend/src/api/index.js (next to the * other per-resource blocks). Then, in the generated ${Name}List, ${Name}Detail, * and ${Name}Form views, delete the local ${name}Api const and import the shared * one instead: * * import { ${name}Api } from '../../api' * * The scaffolded views ship with an identical inline client so they build and * run before you touch the shared api module. This file is NOT auto-merged into * api/index.js on purpose; that module is hand-maintained and shared. * * The create/update/delete calls assume matching POST/PUT/DELETE routes exist * on the backend. The scaffolded api/routes.py only ships list and get; add the * write endpoints when you wire up the form. */ export const ${name}Api = { list(params = {}) { return api.get('/${name}', { params }) }, get(itemId) { return api.get(`/${name}/${itemId}`) }, create(data) { return api.post('/${name}', data) }, update(itemId, data) { return api.put(`/${name}/${itemId}`, data) }, remove(itemId) { return api.delete(`/${name}/${itemId}`) } }