#fetch problem help
13 messages · Page 1 of 1 (latest)
Hope you know that the return statement in the .then callback doesnt return for the main function itself, it returns for the callback
I'm basically saying the return statement in the callback is useless and so is that whole part of the code, you're fetching the user and doing nothing afterward
I'm trying to get the username to be printed in the list with a picture
I think I missed something
Well, since you're in a whole different block from where you're tryna access the user, above that block do let fetchedUser; and in the .then(), do fetchedUser = us for the whole user object or fetchedUser = us.username. up to you.
I put inside return user.fetch ?
return client.users.fetch(user.id) // but how to get username use .than ?
fetching returns a promise
return client.users.fetch(user.id).then((us) => {
const uss = us.username;
console.log(uss)
})
Resolve thr promise and then return the User object