#Object destructuring error

47 messages ยท Page 1 of 1 (latest)

golden forgeBOT
#

๐Ÿ”Ž This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

๐Ÿ•ต๏ธ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

โœ… You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

ruby epoch
#

in the picture the white spots are blurs so i dont leak my info ๐Ÿ™‚

copper badger
#

Try userData.data.email :)

ruby epoch
placid thunder
#

also could you change the name of this thread to a more descriptive one

ruby epoch
#

i didnt know how to call it

copper badger
#

Oh, I didn't fully read. Can you share some code of what exactly userData is defined by?

ruby epoch
#

Object

#

i get res from google authentication

#

Object destructuring error

copper badger
#

And where is the console.log that produces the output in the screenshot?

ruby epoch
#

console.log(response.data)

copper badger
#

So the issue is not the userData variable?

ruby epoch
#

it is

copper badger
#

But you are not console.logging the userData variable, but the response of your own API

ruby epoch
#

from /api/sendToBack i just send the exactly same thing back

copper badger
#

Ok, I understand

#

And response.data.googleId exists but response.data.email returns undefined, correct?

ruby epoch
#

no, i put .googleId and .email next to front end userData

#

after the last line

copper badger
ruby epoch
#

yeah

#

this works

#

this doesn't

#

:Dd

copper badger
#

Ok, I understand

#

But I'm clueless at the moment

#

What happens if you just log userData?

ruby epoch
#

.

#

this pic

copper badger
#

Yeah, got that but I meant if you log it directly

#

Idk either

#

It's weird

ruby epoch
#

oh

#

then i get my email, and only then error

#

so the error is in api

#

but why does it work with googleId

copper badger
#

Because it's trying to parse it as JSON

ruby epoch
#

oh

#

yeah