Skip to content

Commit 69bc17d

Browse files
committed
chore: example query
1 parent 6280986 commit 69bc17d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

playground/src/queries/recipes.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export const RECIPE_QUERY_KEYS = {
2+
root: ['recipes'] as const,
3+
4+
search: (options: { query?: string; page?: number; limit?: number }) =>
5+
[...RECIPE_QUERY_KEYS.root, 'search', options] as const,
6+
7+
detail: (id: string) => [...RECIPE_QUERY_KEYS.root, 'detail', id] as const,
8+
9+
recentList: (options?: { limit?: number }) =>
10+
[
11+
...RECIPE_QUERY_KEYS.root,
12+
'list',
13+
'recent',
14+
...(options ? [options] : []),
15+
] as const,
16+
17+
byAuthor: (authorId: string, options?: { page?: number; limit?: number }) =>
18+
[
19+
...RECIPE_QUERY_KEYS.root,
20+
'list',
21+
'by-author',
22+
authorId,
23+
...(options ? [options] : []),
24+
] as const,
25+
26+
byTags: (tags: string[], options?: { page?: number; limit?: number }) =>
27+
[
28+
...RECIPE_QUERY_KEYS.root,
29+
'list',
30+
'by-tags',
31+
tags,
32+
...(options ? [options] : []),
33+
] as const,
34+
}

0 commit comments

Comments
 (0)