Open History to see the last commit
1import { queryOptions } from '@tanstack/solid-query'
2import { postsAPI } from './api'
3β
4export const postsQueries = {
5 all: () => ['posts'] as const,
6 detail: ({
7 postId,
8 sleep,
9 simulateError,
10 }: {
11 postId: number
12 sleep?: number
13 simulateError?: boolean
14 }) =>
15 queryOptions({
16 queryKey: [
17 ...postsQueries.all(),
18 'detail',
19 postId,
20 sleep,
21 simulateError,
22 ] as const,
23 queryFn: () => postsAPI.getPost({ postId, sleep, simulateError }),
24 }),
25}