'use client'; import { useState, useEffect } from 'react'; import { useNotification } from '../../context/NotificationContext'; export default function TFTPLogsPage() { const [logs, setLogs] = useState([]); const [error, setError] = useState(''); const { showNotification } = useNotification(); const fetchLogs = async () => { try { const response = await fetch('/api/tftp/logs'); const data = await response.json(); if (response.ok) { setLogs(data.logs); setError(''); showNotification('Logs refreshed successfully.', 'success'); } else { setError(data.error); showNotification('Failed to refresh logs.', 'error'); } } catch (err) { setError('Failed to fetch logs'); showNotification('Failed to fetch logs.', 'error'); } }; useEffect(() => { fetchLogs(); }, []); return (

TFTP Server Logs

{error &&
{error}
}
{logs.length > 0 ? (
{logs.join('\n')}
) : (
No logs available or logs are not accessible.
)}
); }