orrshalev / b7-cinema-ebooking

0 stars 0 forks source link

(Frontend -> Backend) Protected procedure not working #4

Closed orrshalev closed 1 year ago

orrshalev commented 1 year ago

(This is on frontend/feature/edit-profile-authed)

I'm trying to get info in the edit profile page to match that of the logged in user, so I've created a protectedProcedure:

Screenshot from 2023-03-18 16-08-01

However, when I call this I get unauthorized errors despite being logged in:

Screenshot from 2023-03-18 16-10-08

jennyngo1925 commented 1 year ago
issue
  1. It seems like ctx.session.user.email is empty or null, so I used an input instead
  2. Use findFirst instead of findUnique because findUnique finds objects based on ID
  3. I changed it to a public procedure because I wasn't able to call the procedure when it's protected for some reason (I can look more into this)
sdfdsf

(In my-account.tsx)

To get the email from the logged in user, i used the data variable from the useSession hook to retrieve it.