Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

queries.ts

23 lines644 Bytes

1export async function fetchProjects(): Promise<
2 Array<{ name: string; full_name: string }>
3> {
4 console.info('Fetching projects')
5​
6 const response = await fetch(
7 `https://api.github.com/users/TanStack/repos?sort=updated`,
8 )
9 await new Promise((r) => setTimeout(r, 1000))
10 return await response.json()
12​
13export async function fetchProject(id: string): Promise<{
14 forks_count: number
15 stargazers_count: number
16 watchers_count: number
17}> {
18 console.info('Fetching project:', id)
19​
20 const response = await fetch(`https://api.github.com/repos/${id}`)
21 await new Promise((r) => setTimeout(r, 1000))
22 return await response.json()