MCPcopy Create free account
hub / github.com/TanStack/query / getPostById

Function getPostById

examples/svelte/basic/src/lib/data.ts:9–15  ·  view source on GitHub ↗
(id: number)

Source from the content-addressed store, hash-verified

7}
8
9export const getPostById = async (id: number): Promise<Post> => {
10 const response = await fetch(
11 `https://jsonplaceholder.typicode.com/posts/${id}`,
12 )
13 const data = (await response.json()) as Post
14 return data
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected