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

Function fetchTodosFromServer

examples/lit/basic/src/todoApi.ts:27–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 })
26
27export async function fetchTodosFromServer(): Promise<TodosResponse> {
28 await delay(90)
29 if (failNextFetch) {
30 failNextFetch = false
31 throw new Error('Forced fetch failure (test)')
32 }
33 requestCount += 1
34
35 return {
36 items: todos.map((todo) => ({ ...todo })),
37 requestCount,
38 source: 'server',
39 }
40}
41
42export async function addTodoOnServer(title: string): Promise<Todo> {
43 await delay(70)

Callers

nothing calls this directly

Calls 1

delayFunction · 0.70

Tested by

no test coverage detected