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

Function fetchPost

e2e/solid-router/rspack-basic-file-based/src/posts.tsx:16–29  ·  view source on GitHub ↗
(postId: string)

Source from the content-addressed store, hash-verified

14}
15
16export const fetchPost = async (postId: string) => {
17 console.info(`Fetching post with id ${postId}...`)
18 const post = await axios
19 .get<PostType>(`${queryURL}/posts/${postId}`)
20 .then((r) => r.data)
21 .catch((err) => {
22 if (err.status === 404) {
23 throw notFound()
24 }
25 throw err
26 })
27
28 return post
29}
30
31export const fetchPosts = async () => {
32 console.info('Fetching posts...')

Callers 1

posts.$postId.tsxFile · 0.90

Calls 4

notFoundFunction · 0.85
infoMethod · 0.65
catchMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected