From 64f5f8c3f9660f649dfdaad07d84aa8c26b9661e Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 25 Jun 2020 12:08:15 +0300 Subject: feat: setup global auth hooks --- hooks/requireAuth.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 hooks/requireAuth.ts (limited to 'hooks/requireAuth.ts') diff --git a/hooks/requireAuth.ts b/hooks/requireAuth.ts new file mode 100644 index 0000000..a7b0e96 --- /dev/null +++ b/hooks/requireAuth.ts @@ -0,0 +1,7 @@ +import { HookContext } from '@feathersjs/feathers'; + +export default async (context: HookContext): Promise => { + if (!context.params.user) throw new Error('This endpoint requires auth!'); + return context; +}; + -- cgit v1.2.3