MCPcopy Create free account
hub / github.com/TanStack/router / fetchPost

Function fetchPost

e2e/solid-router/basic-solid-query/src/posts.ts:22–35  ·  view source on GitHub ↗
(postId: string)

Source from the content-addressed store, hash-verified

20}
21
22const fetchPost = async (postId: string) => {
23 console.info(`Fetching post with id ${postId}...`)
24 await new Promise((r) => setTimeout(r, 500))
25 const post = await axios
26 .get<PostType>(`${queryURL}/posts/${postId}`)
27 .then((r) => r.data)
28
29 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
30 if (!post) {
31 throw new NotFoundError(`Post with id "${postId}" not found!`)
32 }
33
34 return post
35}
36
37export const postQueryOptions = (postId: string) =>
38 queryOptions({

Callers 1

postQueryOptionsFunction · 0.70

Calls 2

infoMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected