Debug register button: log to console, show clear error

This commit is contained in:
root 2026-08-20 18:02:04 +00:00
parent 41019d476d
commit e5dceb250b

View File

@ -223,18 +223,30 @@ const App = {
TG_APP.showAlert('Email и пароль (≥8 символов) обязательны');
return;
}
// disable на время запроса
const btn = document.getElementById('el-register');
btn.disabled = true;
btn.textContent = 'Регистрация...';
try {
await API.Auth.registerEmail({
console.log('registerEmail:', email);
const r = await API.Auth.registerEmail({
email,
password: pass,
name: email.split('@')[0],
consents: { adult: true, terms: true, privacy: true, disclaimer: true },
});
console.log('registerEmail result:', r);
await API.Auth.me();
this.consentGiven = true;
this.showView('map');
} catch (e) {
TG_APP.showAlert('Ошибка: ' + e.message);
console.error('registerEmail error:', e);
btn.disabled = false;
btn.textContent = 'Регистрация';
// покажем ошибку явно
const msg = e?.message || 'unknown error';
if (e?.data) console.error('error data:', e.data);
TG_APP.showAlert('Ошибка регистрации: ' + msg + '\n\nОткрой DevTools (F12) → Console для подробностей.');
}
},