Files
COMERCIAL-GTI/gti-maquina-comercial/public/js/login.js
T
GustavoandClaude Sonnet 5 f5af038e19 chore: import gti-maquina-comercial history via subtree
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

git-subtree-dir: gti-maquina-comercial
git-subtree-mainline: 93ca82979e
git-subtree-split: b77484946f
2026-09-28 15:50:08 -03:00

17 lines
455 B
JavaScript

/* Tela de login: autentica e redireciona para o app. */
el('form-login').addEventListener('submit', async (event) => {
event.preventDefault();
const erroBox = el('login-erro');
erroBox.textContent = '';
try {
await API.post('/api/auth/login', {
username: el('login-username').value,
password: el('login-password').value
});
window.location.href = '/';
} catch (error) {
erroBox.textContent = error.message;
}
});