generated from nholtware/service-template-react
Initial commit
This commit is contained in:
commit
3a8e7184d5
32 changed files with 5218 additions and 0 deletions
23
src/routes/Status.tsx
Normal file
23
src/routes/Status.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { useLoaderData } from "react-router";
|
||||
import { apiGet, type ApiResult } from "../lib/api";
|
||||
|
||||
export async function statusLoader(): Promise<ApiResult[]> {
|
||||
return Promise.all([apiGet("/"), apiGet("/readyz")]);
|
||||
}
|
||||
|
||||
export function Status() {
|
||||
const results = useLoaderData<typeof statusLoader>();
|
||||
return (
|
||||
<section>
|
||||
<h1>Backend status</h1>
|
||||
{results.map((r) => (
|
||||
<article key={r.path}>
|
||||
<h2>
|
||||
GET {r.path} → {r.status}
|
||||
</h2>
|
||||
<pre>{JSON.stringify(r.body, null, 2)}</pre>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue