import { Handlers, PageProps } from "$fresh/server.ts"; import { getTeam, getTeamUsers } from "@/db/mod.ts"; import { type Team, type User } from "@/types.ts"; interface TeamPageProps { team: Team; users: User[]; } export const handler: Handlers = { async GET(request, context) { const { id } = context.params; console.debug({ request, context }); try { const team = await getTeam({ id }); const users = await getTeamUsers(team) || []; return await context.render({ team, users }); } catch (e) { console.error(`Error handling team page for ID '${id}'`, e); return await context.renderNotFound(); } }, }; export default function Team( { data: { team: { createdAt, displayName }, users } }: PageProps< TeamPageProps >, ) { return ( <> Back to dashboard

{displayName} - created {createdAt.toLocaleString()}

Team Members

); }