import { Handlers, PageProps } from "$fresh/server.ts"; import { getUser } from "@/db/mod.ts"; import { type Team, type User } from "@/types.ts"; interface UserPageProps { user: User; } export const handler: Handlers = { async GET(request, context) { console.debug({ request, context }); const user = await getUser({ id: context.params.id }); if (!user) throw "unable to fetch from database"; return await context.render({ user }); }, }; export default function Team( { data: { user: { username, createdAt, displayName } } }: PageProps< UserPageProps >, ) { return ( <>

{(displayName || username).trim()} - joined {createdAt.toLocaleString()}

); }