'use client';
import { useProjects } from '@/lib/hooks/use-projects';
import { useEpics } from '@/lib/hooks/use-epics';
import { useStories } from '@/lib/hooks/use-stories';
import { useTasks } from '@/lib/hooks/use-tasks';
import { Card } from '@/components/ui/card';
import { Skeleton } from '@/components/ui/skeleton';
import { Badge } from '@/components/ui/badge';
export default function ApiTestPage() {
const { data: projects, isLoading: projectsLoading, error: projectsError } = useProjects();
const { data: epics, isLoading: epicsLoading, error: epicsError } = useEpics();
const { data: stories, isLoading: storiesLoading, error: storiesError } = useStories();
const { data: tasks, isLoading: tasksLoading, error: tasksError } = useTasks();
return (
API Connection Test
This page tests the connection to ProjectManagement API endpoints
{/* Projects Section */}
{projects && projects.length > 0 ? (
{projects.map((project) => (
{project.name}
{project.key}
{project.description && (
{project.description}
)}
ID: {project.id.substring(0, 8)}...
))}
) : (
)}
{/* Epics Section */}
{epics && epics.length > 0 ? (
{epics.map((epic) => (
{epic.title}
{epic.description && (
{epic.description}
)}
{epic.status}
{epic.priority}
{epic.estimatedHours && (
{epic.estimatedHours}h
)}
))}
) : (
)}
{/* Stories Section */}
{stories && stories.length > 0 ? (
{stories.map((story) => (
{story.title}
{story.description && (
{story.description}
)}
{story.status}
{story.priority}
{story.estimatedHours && (
{story.estimatedHours}h
)}
))}
) : (
)}
{/* Tasks Section */}
{tasks && tasks.length > 0 ? (
{tasks.map((task) => (
{task.title}
{task.description && (
{task.description}
)}
{task.status}
{task.priority}
{task.estimatedHours && (
{task.estimatedHours}h
)}
))}
) : (
)}
);
}
// Helper Components
interface SectionProps {
title: string;
count?: number;
loading: boolean;
error: any;
children: React.ReactNode;
}
function Section({ title, count, loading, error, children }: SectionProps) {
return (
{title}
{count !== undefined && (
({count})
)}
{loading && Loading...}
{error && Error}
{loading ? (
) : error ? (
Error Loading {title}
{error.message || 'Unknown error occurred'}
{error.response?.status && (
Status Code: {error.response.status}
)}
) : (
children
)}
);
}
function EmptyState({ message }: { message: string }) {
return (
{message}
Try creating some data via the API or check your authentication
);
}