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

Function create

examples/react-native/offline-transactions/src/utils/api.ts:49–64  ·  view source on GitHub ↗
(data: {
    id?: string
    text: string
    completed?: boolean
  })

Source from the content-addressed store, hash-verified

47 },
48
49 async create(data: {
50 id?: string
51 text: string
52 completed?: boolean
53 }): Promise<Todo> {
54 const response = await fetch(`${BASE_URL}/api/todos`, {
55 method: 'POST',
56 headers: { 'Content-Type': 'application/json' },
57 body: JSON.stringify(data),
58 })
59 if (!response.ok) {
60 throw new Error(`Failed to create todo: ${response.status}`)
61 }
62 const todo: TodoResponse = await response.json()
63 return parseTodo(todo)
64 },
65
66 async update(
67 id: string,

Callers

nothing calls this directly

Calls 2

parseTodoFunction · 0.85
fetchFunction · 0.50

Tested by

no test coverage detected