import { api } from '/static/js/api.js'; document.getElementById('reset-form').addEventListener('submit', async (e) => { e.preventDefault(); const errorBox = document.getElementById('error'); errorBox.textContent = ''; const pw = document.getElementById('new').value; if (pw !== document.getElementById('confirm').value) { errorBox.textContent = 'Passwords do not match.'; return; } try { await api('POST', '/api/v1/auth/reset', { token: new URLSearchParams(window.location.search).get('token') || '', newPassword: pw, }); window.location.href = '/login'; } catch (err) { errorBox.textContent = err.message; } });