klg-asutk-app/app/profile/page.tsx
Yuriy a7da43be0e apply recommendations: security, get_db, exceptions, eslint, api-client
- session: set_tenant use bound param (SQL injection fix)
- health: text('SELECT 1'), REDIS_URL from config
- deps: re-export get_db from session, use settings.ENABLE_DEV_AUTH (default False)
- routes: all get_db from app.api.deps; conftest overrides deps.get_db
- main: register exception handlers from app.api.exceptions
- next.config: enable ESLint and TypeScript checks
- .eslintrc: drop @typescript-eslint/recommended; fix no-console (logger, ws-client, regulations)
- backend/.env.example added
- frontend: export apiFetch; dashboard, profile, settings, risks use api-client
- docs/ANALYSIS_AND_RECOMMENDATIONS.md

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-14 21:48:58 +03:00

49 lines
2.3 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import { useState, useEffect } from 'react';
import { PageLayout } from '@/components/ui';
import { apiFetch } from '@/lib/api/api-client';
export default function ProfilePage() {
const [user, setUser] = useState<any>(null);
useEffect(() => {
apiFetch('/users/me').then(setUser).catch(() => setUser({ name: 'Пользователь', email: '', roles: ['user'] }));
}, []);
if (!user) return <PageLayout title="👤 Профиль"><div className="text-center py-8 text-gray-400"></div></PageLayout>;
return (
<PageLayout title="👤 Профиль" subtitle="Информация о пользователе">
<div className="max-w-lg space-y-4">
<div className="card p-6">
<div className="flex items-center gap-4 mb-4">
<div className="w-16 h-16 rounded-full bg-blue-100 flex items-center justify-center text-2xl font-bold text-blue-600">
{(user.name || user.full_name || '?')[0]?.toUpperCase()}
</div>
<div>
<div className="text-lg font-bold">{user.name || user.full_name || 'Пользователь'}</div>
<div className="text-sm text-gray-500">{user.email || ''}</div>
</div>
</div>
<div className="space-y-2 text-sm">
<div className="flex justify-between py-1 border-b border-gray-50">
<span className="text-gray-500">Роль</span>
<span className="font-medium">{(user.roles || ['user']).join(', ')}</span>
</div>
<div className="flex justify-between py-1 border-b border-gray-50">
<span className="text-gray-500">ID</span>
<span className="font-mono text-xs text-gray-400">{user.sub || user.id || '—'}</span>
</div>
</div>
</div>
<div className="card p-4">
<h3 className="text-sm font-bold text-gray-600 mb-2">🔗 Быстрые ссылки</h3>
<div className="space-y-1 text-sm">
<a href="/settings" className="block text-blue-500 hover:underline"> Настройки уведомлений</a>
<a href="/audit-history" className="block text-blue-500 hover:underline">📝 История действий</a>
</div>
</div>
</div>
</PageLayout>
);
}