Check History
{snapshots.length === 0 ? (No history yet
The first check will happen soon
{snapshot.error_message}
)}'use client' import { useEffect } from 'react' import { useRouter, useParams } from 'next/navigation' import { useQuery } from '@tanstack/react-query' import { monitorAPI } from '@/lib/api' import { isAuthenticated } from '@/lib/auth' export default function MonitorHistoryPage() { const router = useRouter() const params = useParams() const id = params?.id as string useEffect(() => { if (!isAuthenticated()) { router.push('/login') } }, [router]) const { data: monitorData } = useQuery({ queryKey: ['monitor', id], queryFn: async () => { const response = await monitorAPI.get(id) return response.monitor }, }) const { data: historyData, isLoading } = useQuery({ queryKey: ['history', id], queryFn: async () => { const response = await monitorAPI.history(id) return response.snapshots }, }) if (isLoading) { return (
Loading...
{monitor.url}
)}No history yet
The first check will happen soon
{snapshot.error_message}
)}