Sign in to your trading dashboard
const errDiv = document.getElementById('loginError'); errDiv.style.display = 'none'; btn.disabled = true; btn.textContent = 'Signing in...'; try { const res = await fetch('/api/auth/login', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({ email: document.getElementById('email').value, password: document.getElementById('password').value }) }); const data = await res.json(); if(!res.ok) throw new Error(data.error || data.message || 'Login failed'); localStorage.setItem('hedgebot_token', data.token); localStorage.setItem('hedgebot_user', JSON.stringify(data.user)); window.location.href = '/dashboard.html'; } catch(err) { errDiv.textContent = err.message; errDiv.style.display = 'block'; btn.disabled = false; btn.textContent = 'Sign in'; } });