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

Function buildProjectsUrl

examples/lit/pagination/src/api.ts:49–66  ·  view source on GitHub ↗
(
  page: number,
  delayMs: number,
  forceError: boolean,
)

Source from the content-addressed store, hash-verified

47const API_BASE_URL = `http://127.0.0.1:${API_PORT}`
48
49function buildProjectsUrl(
50 page: number,
51 delayMs: number,
52 forceError: boolean,
53): URL {
54 const url = new URL('/api/projects', API_BASE_URL)
55 url.searchParams.set('page', String(page))
56
57 if (delayMs > 0) {
58 url.searchParams.set('delay', String(delayMs))
59 }
60
61 if (forceError) {
62 url.searchParams.set('error', 'true')
63 }
64
65 return url
66}
67
68async function readJsonOrThrow<T>(
69 response: Response,

Callers 1

fetchProjectsPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected