2022-08-23 09:01:47 +09:00
|
|
|
import { createResource } from "solid-js";
|
2022-08-24 12:49:02 +09:00
|
|
|
import type Pages from "../protocol/pages";
|
2022-08-23 09:01:47 +09:00
|
|
|
|
2022-08-24 12:49:02 +09:00
|
|
|
async function fetchPages(): Promise<Pages.Response> {
|
2022-08-23 09:01:47 +09:00
|
|
|
const res = await fetch(
|
|
|
|
new URL("/pages?order=updated.desc", import.meta.env.QUOT_API_URL)
|
|
|
|
);
|
2022-08-24 12:49:02 +09:00
|
|
|
const data = (await res.json()) as Pages.Response;
|
|
|
|
return data;
|
2022-08-23 09:01:47 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const [pages] = createResource("pages", fetchPages);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<main>
|
|
|
|
<pre>{() => JSON.stringify(pages(), null, " ")}</pre>
|
|
|
|
</main>
|
|
|
|
);
|
|
|
|
};
|