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');
}