diff options
| author | Guillermo Serrahima <dev@vylion.com> | 2026-03-12 11:09:46 +0100 |
|---|---|---|
| committer | Guillermo Serrahima <dev@vylion.com> | 2026-03-12 11:09:46 +0100 |
| commit | 20abd199c381eeab138563af897b54ecadc57bae (patch) | |
| tree | f1340c1d9e13585fcfd29f9fab2280fcd889387b /frontend/src/login.ts | |
| parent | 60a0ae44cdf9bece1c15f20386e2ffdf80d80e96 (diff) | |
| download | llostre-20abd199c381eeab138563af897b54ecadc57bae.tar.xz llostre-20abd199c381eeab138563af897b54ecadc57bae.zip | |
Implemented OAuth login
Diffstat (limited to 'frontend/src/login.ts')
| -rw-r--r-- | frontend/src/login.ts | 16 |
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)}`; +}); |
