File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments