export default defineNitroPlugin((nitroApp) => { const clients = useRuntimeConfig().public.openFetch Object.entries(clients).forEach(([name, client]) => { // @ts-expect-error - This is a dynamic property nitroApp[$${name}] = createOpenFetch(client) })})
<UTable :rows="latestAppointments" :columns="appointmentColumns"> <template #date-data="{ row }"> <span class="">{{ new Date(row.date).toLocaleString('en-GB') }}</span> </template> <template #reason-data="{ row }"> <span class="">{{ row.reason }}</span> </template></UTable>
UTable
import { AppointmentType } from "~/types/Appointment";export default defineEventHandler(async (event) => { const query = getQuery(event) if (query.userid) { try { let data: any = await appointmentsModel.find({ userid: query.userid }); if (query.latestAppointmentsOnly == "true") { let appointments: AppointmentType[] = data as unknown as AppointmentType[]; data = appointments.filter(appointment => appointment.date.getTime() > (new Date()).getTime()); return { data }; } return { data } } catch (error) { return error } }})