HOME

Optional Page

export default withAuth(OptionalPage, 'optional');
function OptionalPage() { /* react component here */ }

Use this for pages that doesn't require the user to be authenticated but it can access the user object

Behavior

  • This page is accessible to all users

    You're logged out, you should see that the user object is null

    Try it out!

    After you login, you'll be redirected right to this page, then you can see the user object below.

    Login
  • User Object

    const user = useAuthStore.useUser();
    null

    isAuthenticated

    const isAuthenticated = useAuthStore.useIsAuthenticated();
    {
      "isAuthenticated": false
    }