mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 12:31:12 -05:00
Implement strict type enforcement plan
This commit is contained in:
@@ -6,9 +6,10 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { format } from 'date-fns';
|
||||
import { handleError } from '@/lib/errorHandler';
|
||||
import { AuditLogEntry } from '@/types/database';
|
||||
|
||||
export function ProfileAuditLog() {
|
||||
const [logs, setLogs] = useState<any[]>([]);
|
||||
const [logs, setLogs] = useState<AuditLogEntry[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -27,7 +28,7 @@ export function ProfileAuditLog() {
|
||||
.limit(50);
|
||||
|
||||
if (error) throw error;
|
||||
setLogs(data || []);
|
||||
setLogs((data || []) as AuditLogEntry[]);
|
||||
} catch (error) {
|
||||
handleError(error, { action: 'Load audit logs' });
|
||||
} finally {
|
||||
@@ -64,13 +65,13 @@ export function ProfileAuditLog() {
|
||||
{logs.map((log) => (
|
||||
<TableRow key={log.id}>
|
||||
<TableCell>
|
||||
{log.profiles?.display_name || log.profiles?.username || 'Unknown'}
|
||||
{(log as { profiles?: { display_name?: string; username?: string } }).profiles?.display_name || (log as { profiles?: { username?: string } }).profiles?.username || 'Unknown'}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant="secondary">{log.action}</Badge>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<pre className="text-xs">{JSON.stringify(log.changes, null, 2)}</pre>
|
||||
<pre className="text-xs">{JSON.stringify(log.changes || {}, null, 2)}</pre>
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-muted-foreground">
|
||||
{format(new Date(log.created_at), 'PPpp')}
|
||||
|
||||
Reference in New Issue
Block a user