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

Function fetchUser

examples/solid/solid-start-streaming/src/utils/api.ts:42–63  ·  view source on GitHub ↗
({
  sleep,
  simulateError,
}: { sleep?: number; simulateError?: boolean } = {})

Source from the content-addressed store, hash-verified

40}
41
42export const fetchUser = async ({
43 sleep,
44 simulateError,
45}: { sleep?: number; simulateError?: boolean } = {}) => {
46 console.info('[api] fetchUser.start', { sleep, simulateError })
47
48 if (sleep) {
49 await doSleep(sleep)
50 }
51
52 console.info('[api] fetchUser.done', { sleep, simulateError })
53
54 if (simulateError) {
55 throw new Error('API request to get user was not OK')
56 }
57
58 return {
59 id: 'abc',
60 name: `john doe`,
61 queryTime: Date.now(),
62 }
63}

Callers 2

userInfoQueryOptsFunction · 0.90
HydrationFunction · 0.90

Calls 1

doSleepFunction · 0.85

Tested by

no test coverage detected