From d5bf42a91382d77eb8d64f442148a57570d3d5c3 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Aug 2026 12:06:28 +0000 Subject: [PATCH] =?UTF-8?q?Debug:=20UserProfileView=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D1=80=D1=83=D0=B5=D1=82=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20/debug/log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/views/profile.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/public/js/views/profile.js b/public/js/views/profile.js index 90383cc..86363cb 100644 --- a/public/js/views/profile.js +++ b/public/js/views/profile.js @@ -209,6 +209,7 @@ const UserProfileView = { async render(root, params) { this.userId = params.userId; this.userName = params.name || 'Пользователь'; + console.log('[UserProfile] render start, userId:', this.userId, 'name:', this.userName, 'params:', JSON.stringify(params)); root.innerHTML = `

👤 ${escapeHtml(this.userName)}

@@ -220,9 +221,9 @@ const UserProfileView = { API.UserApi.get(this.userId), API.ReviewApi.stats(this.userId).catch(() => ({})), ]); + console.log('[UserProfile] loaded:', u && u.id, 'user:', JSON.stringify(user).slice(0,200), 'stats:', JSON.stringify(stats)); this.data = user.user || user; const u = this.data; - console.log('[UserProfile] loaded:', u && u.id, 'stats:', stats); const init = ((u.name || u.email || '?')[0] || '?').toUpperCase(); const rating = stats.rating_avg ? Number(stats.rating_avg).toFixed(1) : '—'; const reviewsCount = stats.rating_count || 0; @@ -274,7 +275,11 @@ const UserProfileView = { const revBtn = document.getElementById('up-reviews'); if (revBtn) revBtn.onclick = () => UserReviewsView.render(root, { userId: this.userId, userName: u.name }); } catch (e) { - console.error('[UserProfile] load failed:', e, 'userId:', this.userId); + console.error('[UserProfile] load failed:', e && e.message, 'userId:', this.userId, 'stack:', e && e.stack); + // ship to backend debug log + try { + fetch('/api/v1/debug/log', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ kind: 'UserProfileError', msg: String(e && e.message), userId: String(this.userId), stack: String(e && e.stack || '').slice(0, 500) }) }); + } catch {} document.getElementById('up-content').innerHTML = `
⚠️ Не удалось загрузить
`; App._toast('Ошибка загрузки профиля', 'err'); }