Skip to main content

Check if a Member is Logged-in or Logged-out

Memberstack Team
Memberstack Team
  • Updated

We recommend checking to see if the member.data returns member info or is null. If it returns null, it means the current "member" does not have an account or is logged out. 

<script>
window.$memberstackDom.getCurrentMember().then((member) => {
      if (member.data) {
        console.log('there is a member', member);
        // do logged in logic here
      } else {
        console.log('no member', member);
         // do logged out logic here
      }
    })
</script>

Still not sure? Check out this video introduction to using the DOM API.

-------

Related Articles:

Show or hide content based on logged-in status → 

Create a logout button → 

DOM Package API Docs → 

Was this article helpful?

Didn’t find your answer?

Get an instant answer from Rey, or reach a human. Either way, we’re happy to help.

Comments

No comments yet. Start the conversation below.

Please sign in to leave a comment.

Sitemap