MCPcopy Create free account
hub / github.com/TanStack/db / create

Function create

examples/electron/offline-first/src/utils/api.ts:20–34  ·  view source on GitHub ↗
(data: {
    id: string
    text: string
    completed?: boolean
  })

Source from the content-addressed store, hash-verified

18 },
19
20 async create(data: {
21 id: string
22 text: string
23 completed?: boolean
24 }): Promise<Todo> {
25 const response = await fetch(`${BASE_URL}/api/todos`, {
26 method: 'POST',
27 headers: { 'Content-Type': 'application/json' },
28 body: JSON.stringify(data),
29 })
30 if (!response.ok) {
31 throw new Error(`Failed to create todo: ${response.status}`)
32 }
33 return response.json()
34 },
35
36 async update(
37 id: string,

Callers

nothing calls this directly

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected