File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change
1
+ import { HookContext } from '@feathersjs/feathers' ;
2
+ import { authenticate } from '@feathersjs/authentication' ;
3
+
4
+
5
+ export default async ( context : HookContext ) : Promise < boolean > => {
6
+ console . log ( context . params . authenticated ) ;
7
+ return context . params . authenticated || false ;
8
+ } ;
9
+
Original file line number Diff line number Diff line change
1
+ import { iff , isNot } from 'feathers-hooks-common' ;
1
2
import { NotAuthenticated } from '@feathersjs/errors' ;
2
- import { HookContext } from '@feathersjs/feathers ' ;
3
+ import isAuthenticated from './isAuthenticated ' ;
3
4
4
- export default async ( context : HookContext ) : Promise < HookContext > => {
5
- if ( ! context . params . authenticated ) {
6
- throw new NotAuthenticated ( 'This endpoint requires auth!' ) ;
7
- }
8
- return context ;
9
- } ;
5
+ export default iff (
6
+ isNot ( isAuthenticated ) ,
7
+ ( ) => { throw new NotAuthenticated ( 'This endpoint requires auth!' ) }
8
+ ) ;
10
9
You can’t perform that action at this time.
0 commit comments