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

Function fetchPost

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

Source from the content-addressed store, hash-verified

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

Callers 1

main.tsxFile · 0.90

Calls 2

infoMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected