aboutsummaryrefslogtreecommitdiff
path: root/hooks/requireAuth.ts
blob: 52e8974ce529da337b97c1297fed812ce6dfec35 (plain)
1
2
3
4
5
6
7
8
9
10
import { NotAuthenticated } from '@feathersjs/errors';
import { HookContext } from '@feathersjs/feathers';

export default async (context: HookContext): Promise<HookContext> => {
  if (!context.params.authenticated) {
    throw new NotAuthenticated('This endpoint requires auth!');
  }
  return context;
};