Open History to see the last commit
1import { queryOptions } from '@tanstack/preact-query'
2import { postsAPI } from './api'
3β
4export const postsQueries = {
5 all: () => ['posts'] as const,
6 list: () =>
7 queryOptions({
8 queryKey: [...postsQueries.all(), 'list'] as const,
9 queryFn: () => postsAPI.getPosts(),
10 }),
11 detail: (postId: string) =>
12 queryOptions({
13 queryKey: [...postsQueries.all(), 'detail', postId] as const,
14 queryFn: () => postsAPI.getPost(postId),
15 }),
16}