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

Function fetchPost

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

Source from the content-addressed store, hash-verified

15}
16
17export const fetchPost = async (postId: string) => {
18 console.info(`Fetching post with id ${postId}...`)
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 new PostNotFoundError(`Post with id "${postId}" not found!`)
25 }
26 throw err
27 })
28
29 return post
30}
31
32export const fetchPosts = async () => {
33 console.info('Fetching posts...')

Callers 1

postQueryOptionsFunction · 0.90

Calls 3

infoMethod · 0.65
catchMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected