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

Function fetchPost

e2e/solid-router/basic-file-based/src/posts.tsx:16–30  ·  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 await new Promise((r) => setTimeout(r, 500))
19 const post = await axios
20 .get<PostType>(`${queryURL}/posts/${postId}`)
21 .then((r) => r.data)
22 .catch((err) => {
23 if (err.status === 404) {
24 throw notFound()
25 }
26 throw err
27 })
28
29 return post
30}
31
32export const fetchPosts = async () => {
33 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