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

+page.ts

11 lines292 Bytes

1import type { PageLoad } from './$types'
2import { api } from '$lib/api'
3​
4export const load: PageLoad = async ({ parent, fetch }) => {
5 const { queryClient } = await parent()
6​
7 await queryClient.prefetchQuery({
8 queryKey: ['posts', 10],
9 queryFn: () => api(fetch).getPosts(10),
10 })