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

Function update

examples/react-native/shopping-list/src/utils/api.ts:57–71  ·  view source on GitHub ↗
(
    id: string,
    data: { name?: string },
  )

Source from the content-addressed store, hash-verified

55 },
56
57 async update(
58 id: string,
59 data: { name?: string },
60 ): Promise<ApiTxResult<{ list: ShoppingList }> | null> {
61 const response = await offlineAwareFetch(`${API_URL}/api/lists/${id}`, {
62 method: 'PUT',
63 headers: { 'Content-Type': 'application/json' },
64 body: JSON.stringify(data),
65 })
66 if (response.status === 404) return null
67 if (!response.ok) {
68 throw new Error(`Failed to update list: ${response.status}`)
69 }
70 return response.json()
71 },
72
73 async delete(id: string): Promise<ApiTxResult<{ success: boolean }> | null> {
74 const response = await offlineAwareFetch(`${API_URL}/api/lists/${id}`, {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected