Whenever I attempt to assign user._id
to an entity in a before hook, I keep receiving an "undefined" message.
Below is the code for the hook:
module.exports = (options = {}) => {
return async context => {
const user = context.params.user;
context.data = {
...
userId: user._id,
...
};
return context;
};
};
This snippet shows my hooks register:
before: {
...
create: [processProperty(), authenticate('jwt')],
...
}
}