code dump frontend

This commit is contained in:
2024-12-02 18:29:45 -05:00
parent 44f1f35caa
commit 9e8cf4b147
19 changed files with 681 additions and 184 deletions

View File

@ -1,16 +1,28 @@
import { FreshContext, Handlers, PageProps } from "$fresh/server.ts";
import { useFetch } from "../../lib/useFetch.tsx";
interface PostResponse {
interface PageData {
post_id: number;
first_nane: string;
last_name: string;
title: string;
body: string;
created_at: string;
is_featured: boolean;
}
export default function PostIdentifier(props: PageProps) {
console.log(props.data);
return <div>BLOG POST #{props.params.id}</div>;
export const handler: Handlers<PageData> = {
async GET(_req: Request, ctx: FreshContext) {
const postResult = await fetch(
`${Deno.env.get("BASE_URI_API")}/posts/${ctx.params.id}`,
);
const postData = await postResult.json();
return ctx.render({
postData,
});
},
};
export default function PostIdentifier({ data }: PageProps<PageData>) {
return <div className=""></div>;
}