aboutsummaryrefslogtreecommitdiff
path: root/services/votes/votes.hooks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'services/votes/votes.hooks.ts')
-rw-r--r--services/votes/votes.hooks.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/services/votes/votes.hooks.ts b/services/votes/votes.hooks.ts
index a41b8a9..63f19e3 100644
--- a/services/votes/votes.hooks.ts
+++ b/services/votes/votes.hooks.ts
@@ -1,12 +1,15 @@
+import { HookContext } from '@feathersjs/feathers';
import { authenticate } from '@feathersjs/authentication';
-import convertPoll from '../../hooks/convertPoll';
+
+const addUserId = async (context: HookContext): Promise<HookContext> => {
+ const { params: { user} } = context;
+ context.data.userId = user._id;
+ return context;
+};
export default {
before: {
- create: [authenticate('jwt')]
- },
- after: {
- all: [convertPoll]
+ create: [authenticate('jwt'), addUserId]
}
};