Open History to see the last commit
1import { queryOptions } from '@tanstack/svelte-query'
2import { api } from './api'
3β
4export const postsQueryOptions = (limit: number, customFetch?: typeof fetch) =>
5 queryOptions({
6 queryKey: ['posts', limit],
7 queryFn: () => api(customFetch).getPosts(limit),
8 })
9β
10export const postQueryOptions = (id: number, customFetch?: typeof fetch) =>
11 queryOptions({
12 queryKey: ['post', id],
13 queryFn: () => api(customFetch).getPostById(id),
14 })