@joystick.js/ui

accounts.logout()

How to use the accounts.logout() method in your app.

To logout the current user in your app, you can utilize the accounts.logout() method.

Example Usage

Example Usage

import joystick, { accounts } from '@joystick.js/ui';

const Dashboard = joystick.component({
  events: {
    'click .logout': async (event = {}, instance = {}) => {
      await accounts.logout();
      location.pathname = '/login';
    },
  },
  render: ({ props, state, data, each, when, methods }) => {
    return `
      <div class="dashboard">
        <nav>
          <a href="/"><img src="/logo.svg" alt="Brand" /></a>
          <ul>
            <li><a href="/">Dashboard</a></li>
            <li><a href="/friends">Friends</a></li>
            <li><a href="/messages">Messages</a></li>
            <li class="logout"><a href="#">Logout</a></li>
          </ul>
        </nav>
      </div>
    `;
  },
});

export default Dashboard;

API

accounts.logout() => promise()
This method does not support any parameters.