wasp
wasp copied to clipboard
Allow users to send a plain `User` when calling authenticated operations on the server
#2044 closed #1909, but we're not yet quite where we wanted to be.
See the comment for the API's original specification: https://github.com/wasp-lang/wasp/issues/1909#issuecomment-2104476140.
We're still missing the feature that allows the user argument to be of type User (not only AuthUser):
// current type signature
getFoo(payload: Input, { user }: { user: AuthUser })
// desired type signature
getFoo(payload: Input, { user }: { user: User | AuthUser })
The getFoo function should be overloaded and its implementation should figure out whether the caller sent a User or an AuthUser and act accordingly.
We want this feature because, outside of an operation, the User is much more easily attainable than an AuthUser.
User hitting this: https://discord.com/channels/686873244791210014/1374829396929548408/1375183950967869581