aboutsummaryrefslogtreecommitdiff
path: root/hooks/requireAuth.ts
blob: ba08f57bfbf4865e2e5ff1569a8efc4a27caceab (plain)
1
2
3
4
5
6
7
8
9
10
11
import { iff, isNot } from 'feathers-hooks-common';
import { NotAuthenticated } from '@feathersjs/errors';
import isAuthenticated from './isAuthenticated';

export default iff(
  isNot(isAuthenticated),
  () => {
    throw new NotAuthenticated('This endpoint requires auth!');
  }
);