diff options
| author | LLLL Colonq <llll@colonq> | 2024-01-12 14:54:22 -0500 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-01-12 14:54:32 -0500 |
| commit | 094d3e0e1370f2f8b3619ba6cea8b33ac83dceed (patch) | |
| tree | 01ae4f2706d32ef1433c60d60dcabb1e479be463 /fig-frontend/client/src/components/login.ts | |
| parent | 45980c6910a7fe16ec41b1663b79cebc6e33350d (diff) | |
Update frontend
Diffstat (limited to 'fig-frontend/client/src/components/login.ts')
| -rw-r--r-- | fig-frontend/client/src/components/login.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/fig-frontend/client/src/components/login.ts b/fig-frontend/client/src/components/login.ts new file mode 100644 index 0000000..195c97f --- /dev/null +++ b/fig-frontend/client/src/components/login.ts @@ -0,0 +1,34 @@ +import { html, css, LitElement } from "lit"; +import { customElement } from "lit/decorators.js"; + +import * as Config from "../config"; +import * as Twitch from "../twitch"; + +@customElement("fig-login") +export class Login extends LitElement { + static styles = css` + `; + + login() { + Twitch.startTwitchAuth(); + } + + async check() { + const resp = await fetch(`${Config.API_URL}/check`); + console.log(await resp.text()); + } + + render() { + const token = Twitch.getAuthToken(); + console.log(token); + if (token) { + return html` +<button @click=${this.check}>check token</button> +`; + } else { + return html` +<button @click=${this.login}>login</button> +`; + } + } +} |
