How do I send the currently logged in user on a request?
I have this entity:
Movement:
seedCount: 3
mainProp: movementType
properties:
- { name: movementType, type: text, validation: { isNotEmpty: true } }
- { name: date, type: date }
- { name: notes, type: text }
belongsTo:
- Sign
- User
- Property
- StorageLocation
Which belongs to an User.
I've found the only way to send the User is to send it in the form as a hidden field, which of course isn't secure or ideal.
// Create movement data - userId from hidden field
const movementData: MovementData = {
signId,
movementType,
date: formattedDate,
notes: formData.get("notes") as string,
userId: Number(formData.get("userId")),
};
Any tips on how this should be done?
1 Reply
Hello @Ian this will be implemented on the next release through a hook/middleware where you will be able to get the logged user id and patch it to your object