| 1 | /** |
| 2 | * The Files page's About as JSON, asked for again by the panel while the |
| 3 | * default branch is first being read (components/repo-about.tsx). |
| 4 | */ |
| 5 | import { data } from "react-router"; |
| 6 | |
| 7 | import type { Route } from "./+types/about-json"; |
| 8 | import { repos } from "../../lib/services.server"; |
| 9 | import { getViewer } from "../../lib/session.server"; |
| 10 | |
| 11 | export async function loader({ params, context }: Route.LoaderArgs) { |
| 12 | const found = await repos.about({ namespace: params.owner, name: params.repo }, getViewer(context)); |
| 13 | if (!found.ok) throw data({ error: found.error.message }, { status: 404 }); |
| 14 | return Response.json(found.value, { headers: { "cache-control": "no-store" } }); |
| 15 | } |