Создать аккаунт

Присоединитесь к ExpiresFlow

или
или

Уже есть аккаунт? Войти

function showTgProfileModal() { document.getElementById('tgProfileModal').classList.remove('hidden'); } function closeTgProfileModal() { document.getElementById('tgProfileModal').classList.add('hidden'); } document.getElementById('tgProfileForm').addEventListener('submit', async function(e) { e.preventDefault(); const email = document.getElementById('tg_email').value.trim(); const username = document.getElementById('tg_username').value.trim(); if (!email || !username) { showToast('Заполните все поля', 'error'); return; } try { const token = localStorage.getItem('access_token'); const response = await fetch('/api/auth/telegram-profile-update', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token }, body: JSON.stringify({ email, username }) }); const data = await response.json(); if (response.ok && data.access_token) { setToken(data.access_token); closeTgProfileModal(); showToast('Профиль обновлён!', 'success'); setTimeout(() => { window.location.href = '/dashboard'; }, 1000); } else { showToast(data.detail || 'Ошибка обновления профиля', 'error'); } } catch (err) { showToast('Ошибка соединения', 'error'); } });