@@ -12,7 +12,7 @@ Typical usage of `use()` looks like this:
1212``` ts
1313use (userTable , async (ctx ) => {
1414 // Call the next registered hook (or the implementation)
15- const result = await ctx .next ();
15+ const result = await ctx .next (... ctx . params );
1616 // Return results
1717 return result ;
1818});
@@ -56,15 +56,15 @@ Additionally, hooks themselves are called in the reverse order of when they were
5656// Register a hook on the entire database
5757use (db , async (ctx ) => {
5858 console .log (" 1" );
59- const result = await ctx .next ();
59+ const result = await ctx .next (... ctx . params );
6060 console .log (" 6" );
6161 return result ;
6262});
6363
6464// Register a hook on the userTable
6565use (userTable , async (ctx ) => {
6666 console .log (" 2" );
67- const result = await ctx .next ();
67+ const result = await ctx .next (... ctx . params );
6868 console .log (" 5" );
6969 return result ;
7070});
@@ -73,7 +73,7 @@ use(userTable, async (ctx) => {
7373// - this will be called after the second hook
7474use (userTable , async (ctx ) => {
7575 console .log (" 3" );
76- const result = await ctx .next ();
76+ const result = await ctx .next (... ctx . params );
7777 console .log (" 4" );
7878 return result ;
7979});
@@ -116,7 +116,7 @@ The name of the method currently executing a hook can be retrieved with `ctx.act
116116``` ts
117117use (userTable , async (ctx ) => {
118118 console .log (ctx .action );
119- const result = await ctx .next ();
119+ const result = await ctx .next (... ctx . params );
120120 return result ;
121121});
122122
@@ -133,7 +133,7 @@ use(userTable, async (ctx) => {
133133 if (isAction (ctx , " count" )) {
134134 console .log (" User has executed count()!" );
135135 }
136- const result = await ctx .next ();
136+ const result = await ctx .next (... ctx . params );
137137 return result ;
138138});
139139```
@@ -144,10 +144,10 @@ It provides the same functionality as a `ctx.action === "count"` check, but addi
144144use (userTable , async (ctx ) => {
145145 if (isAction (ctx , " count" )) {
146146 // `result` is now typed as `number`!
147- const result = await ctx .next ();
147+ const result = await ctx .next (... ctx . params );
148148 }
149149 // Out here, `result` can be anything - a number, one entity, a list of entities...
150- const result = await ctx .next ();
150+ const result = await ctx .next (... ctx . params );
151151 return result ;
152152});
153153```
0 commit comments