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

Function fetchPost

e2e/react-router/basic-react-query/src/posts.ts:25–37  ·  view source on GitHub ↗
(postId: string)

Source from the content-addressed store, hash-verified

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

Callers 1

postQueryOptionsFunction · 0.70

Calls 2

infoMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected