MCPcopy Create free account
hub / github.com/cosdensolutions/code / fetchTodos

Function fetchTodos

videos/long/react-query-tutorial/src/api/index.ts:34–47  ·  view source on GitHub ↗
(query = "")

Source from the content-addressed store, hash-verified

32 * Mock function that mimics fetching todos from a database.
33 */
34export const fetchTodos = async (query = ""): Promise<Todo[]> => {
35 await new Promise((resolve) => setTimeout(resolve, 1000));
36
37 console.log("fetched todos");
38
39 const filteredTodos = todos.filter((todo) =>
40 todo.title.toLowerCase().includes(query.toLowerCase())
41 );
42
43 // Uncomment the line below to trigger an error
44 // throw new Error();
45
46 return [...filteredTodos];
47};
48
49/**
50 * Mock function that mimics adding a todo to a database.

Callers 1

DemoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected