JS functions- After user logs in, display user profile image

I watched the tutorial on using a function to display the user’s name when they log in.
https://www.youtube.com/watch?v=to3iR5EcRks

I am trying to swapout the default user profile image with the user’s profile image after they log in. Will you look at my script and provide some tips to get it to work. See attachment.

@talentbender

have you updated the /me endpoint in Xano to include the profile_image? That is where the user profile is being pulled from in WeWeb.

If so:

if(!plugins.xanoAuth.isAuthenticated || !plugins.xanoAuth){
return “defaultImagePath”;
}
else {
return plugins.xanoAuth.user.profile_image;
}

Not sure if relevant, but you could also do this with nocode by binding the value of the image SRC to the profiile_image… If there is no profile image, set it to default value.

1 Like

Hi, Kevin! Thanks for the tips! No, I updated the endpoint. I didn’t know to do that. I’ll definitely try the no-code approach.

2 Likes