Next.js Discord

Discord Forum

Object destructuring error

Unanswered
Saltwater Crocodile posted this in #help-forum
Open in Discord
Original message was deleted.

45 Replies

Saltwater Crocodile
in the picture the white spots are blurs so i dont leak my info 🙂
Original message was deleted
Try userData.data.email :)
Saltwater Crocodile
also could you change the name of this thread to a more descriptive one
Saltwater Crocodile
i didnt know how to call it
Oh, I didn't fully read. Can you share some code of what exactly userData is defined by?
Saltwater Crocodile
i get res from google authentication
Original message was deleted
And where is the console.log that produces the output in the screenshot?
Saltwater Crocodile
console.log(response.data)
So the issue is not the userData variable?
Saltwater Crocodile
it is
But you are not console.logging the userData variable, but the response of your own API
Saltwater Crocodile
from /api/sendToBack i just send the exactly same thing back
Ok, I understand
And response.data.googleId exists but response.data.email returns undefined, correct?
Saltwater Crocodile
no, i put .googleId and .email next to front end userData
after the last line
@Saltwater Crocodile no, i put .googleId and .email next to front end userData
So you mean you try to only send userData.email or userData.googleId to your API and only googleId works?
Saltwater Crocodile
yeah
this works
this doesn't
:Dd
Ok, I understand
But I'm clueless at the moment
What happens if you just log userData?
Original message was deleted
Saltwater Crocodile
.
this pic
Yeah, got that but I meant if you log it directly
Idk either
It's weird
Saltwater Crocodile
oh
then i get my email, and only then error
so the error is in api
but why does it work with googleId
Because it's trying to parse it as JSON
Saltwater Crocodile
oh
yeah
ty