ManifestM
Manifestβ€’12mo ago
Ian

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?
Was this page helpful?