MCPcopy Create free account
hub / github.com/TanStack/query / addTodoOnServer

Function addTodoOnServer

examples/lit/basic/src/todoApi.ts:42–58  ·  view source on GitHub ↗
(title: string)

Source from the content-addressed store, hash-verified

40}
41
42export async function addTodoOnServer(title: string): Promise<Todo> {
43 await delay(70)
44 if (failNextMutation) {
45 failNextMutation = false
46 throw new Error('Forced mutation failure (test)')
47 }
48
49 const nextTodo: Todo = {
50 id: nextTodoId,
51 title,
52 }
53
54 nextTodoId += 1
55 todos = [...todos, nextTodo]
56
57 return { ...nextTodo }
58}
59
60export function resetTodoApi(): void {
61 todos = [

Callers

nothing calls this directly

Calls 1

delayFunction · 0.70

Tested by

no test coverage detected