Skip to content

Instantly share code, notes, and snippets.

@tjmonsi
Created December 15, 2021 10:32
Show Gist options
  • Save tjmonsi/6ca4d1875854d2c9227eea6ef7561853 to your computer and use it in GitHub Desktop.
Save tjmonsi/6ca4d1875854d2c9227eea6ef7561853 to your computer and use it in GitHub Desktop.
import { LitElement, html } from 'lit';
import { state } from '../../worker/index.js';
export class Page extends LitElement {
connectedCallback () {
super.connectedCallback();
this.logout();
}
async logout () {
const result = await window.fetch('/auth/logout');
await state.set('token', null);
await state.set('username', null);
const el = document.querySelector('small-router');
el.changeUrl('/');
}
}
window.customElements.define('logout-page', Page);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment