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)}`; });