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()