Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Why is result undefined

$
0
0

I am trying to access a user's details from a get Request but I cannot figure out for the life of me why the I can only log some of the response results...

Here is the request:

let user  = (await Requests.GET("/user/test-user-3", accesToken3)).user;

Here is the response in the console:

 {  pk: 'user#test-user-3',          sk: 'user#test-user-3',          entity: 'user',          id: 'test-user-2',          companyId: 'test-company',          fName: 'Test',          lName: 'User 2',          email: 'test2@gmail.com',          isComplete: true,          weight: 80,          height: 160,          dob: '15/09/1998',          fitnessTrackers: [],          department: 'Development',          location: 'USA',          coins: 100,          gender: 'male'}

Here is the what I log:

    console.log("COINS: ", user.coins);

And I get a result of:

'COINS: ', 100

But when I try to log out the user's fname like:

    console.log("Name: ", user.fname);

I get a result of undefined

I really just don't understand what the problem is here at all please help!!


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>