aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/login.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/login.ts')
-rw-r--r--frontend/src/login.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/frontend/src/login.ts b/frontend/src/login.ts
new file mode 100644
index 0000000..d8054c0
--- /dev/null
+++ b/frontend/src/login.ts
@@ -0,0 +1,16 @@
+const loginForm = document.getElementById('login-form') as HTMLFormElement;
+const handleInput = document.getElementById('handle-input') as HTMLInputElement;
+const loginError = document.getElementById('login-error') as HTMLDivElement;
+
+loginForm.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const handle = handleInput.value.trim();
+
+ if (!handle) {
+ loginError.textContent = 'please enter a handle';
+ return;
+ }
+
+ loginError.textContent = '';
+ window.location.href = `/api/login?handle=${encodeURIComponent(handle)}`;
+});