From eeac56190c1363789e7a558ae40b698515881cee Mon Sep 17 00:00:00 2001 From: Damir Date: Sat, 16 May 2026 02:48:18 +0300 Subject: [PATCH] 10 --- frontend/js/app.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/js/app.js b/frontend/js/app.js index b369bce..9b75250 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -107,16 +107,20 @@ function initAuth() { if (isLoginMode) { const res = await api.login(username, password); localStorage.setItem('token', res.token); + // Сразу показываем приложение без перезагрузки + currentUser = await api.getMe(); + const planBadge = currentUser.plan === 'pro' ? '[PRO]' : '[FREE]'; + document.getElementById('username-display').innerHTML = `Привет, ${currentUser.username} ${planBadge}`; + showApp(); + if (window.lucide) lucide.createIcons(); } else { await api.register(username, password); - alert('Регистрация успешна! Теперь вы можете войти.'); isLoginMode = true; title.textContent = 'Вход в систему'; toggleBtn.textContent = 'Нет аккаунта? Зарегистрироваться'; submitBtn.textContent = 'Войти'; - return; + showToast('Регистрация успешна! Войдите в систему.', 'success'); } - window.location.reload(); } catch (err) { alert(err.message); }