File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change
1
+ import { HookContext } from '@feathersjs/feathers' ;
1
2
import { authenticate } from '@feathersjs/authentication' ;
2
- import convertPoll from '../../hooks/convertPoll' ;
3
+
4
+ const addUserId = async ( context : HookContext ) : Promise < HookContext > => {
5
+ const { params : { user} } = context ;
6
+ context . data . userId = user . _id ;
7
+ return context ;
8
+ } ;
3
9
4
10
export default {
5
11
before : {
6
- create : [ authenticate ( 'jwt' ) ]
7
- } ,
8
- after : {
9
- all : [ convertPoll ]
12
+ create : [ authenticate ( 'jwt' ) , addUserId ]
10
13
}
11
14
} ;
12
15
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import hooks from './votes.hooks';
7
7
const VoteService = service ( { Model } ) ;
8
8
9
9
export default ( app : Application ) : void => {
10
- app . use ( '/votes/ ' , VoteService ) ;
10
+ app . use ( '/votes' , VoteService ) ;
11
11
app . service ( 'votes' ) . hooks ( hooks ) ;
12
12
} ;
13
13
You can’t perform that action at this time.
0 commit comments