"use client" import { use } from "react" import { useQuery } from "@tanstack/react-query" import { useAuthApi } from "@/shared/useApi" import { APPOINTMENT_ROUTES } from "@garage/api" import { AppointmentGeneralInfo } from "@/modules/appointments/appointment-general-info" import DashboardPage from "@/base/components/layout/dashboard/dashboard-page" import { Skeleton } from "@/shared/components/ui/skeleton" export default function AppointmentDetailsPage({ params }: { params: Promise<{ id: string }> }) { const { id } = use(params) const api = useAuthApi() const { data, isLoading } = useQuery({ queryKey: [APPOINTMENT_ROUTES.INDEX, "detail", id], queryFn: async () => { const response = await api.appointments.list() const items = (response as any)?.data ?? [] return items.find((item: any) => String(item.id) === id) ?? null }, }) if (isLoading) { return ( {Array.from({ length: 4 }).map((_, i) => ( ))} ) } if (!data) { return ( Appointment not found. ) } return ( ) }
Appointment not found.