How to check if a member has a profile image using the DOM package

Article author
Josh Lopez
  • Updated

If you are looking to see if a member has a profile image using the DOM package you can use the following code as a starting point:

window.$memberstackDom.getCurrentMember().then((member) => {
  if (member.data) {
    if (member.data['profileImage']) {
      console.log('Member has a profile image');
      // Do something if the member has a profile image
    } else {
      console.log('Member does not have a profile image');
      // Do something if the member does not have a profile image
    }
  } else {
    console.log('No member data');
    // Do something if there is no member data (member is logged out)
  }
});

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.