trucs inutilesé
This commit is contained in:
42
frontend/app/(main)/blogs/[slug]/page.tsx
Normal file
42
frontend/app/(main)/blogs/[slug]/page.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
"use server";
|
||||
|
||||
import BlogItem, { BlogItemParams } from "@/components/blogItem";
|
||||
import { Blog } from "@/types/types";
|
||||
|
||||
export default async function HistoryDetails({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ blog_id: string }>;
|
||||
}) {
|
||||
const { blog_id } = await params;
|
||||
let blog = {}
|
||||
try {
|
||||
const res = await fetch('http://localhost:3001/blogs/' + blog_id, {method: "GET"})
|
||||
blog = await res.json()
|
||||
console.log(blog as Blog)
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
if(blog == null) {
|
||||
return(
|
||||
<>
|
||||
Error
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const blog_item_params: BlogItemParams = {
|
||||
title_style:
|
||||
"py-12 mb-3 text-pretty text-xl font-semibold md:mb-4 md:text-4xl lg:mb-6 lg:max-w-3xl lg:text-3xl",
|
||||
subtitle_style:
|
||||
"py-12 mb-3 text-pretty text-xl font-semibold md:mb-4 md:text-4xl lg:mb-6 lg:max-w-3xl lg:text-3xl",
|
||||
p_style:
|
||||
"blog-paragraph mb-5 text-muted-foreground md:text-base lg:max-w-2xl lg:text-lg",
|
||||
default_img:
|
||||
"https://shadcnblocks.com/images/block/placeholder-dark-1.svg",
|
||||
blog: blog as Blog,
|
||||
};
|
||||
|
||||
return <BlogItem params={blog_item_params} />;
|
||||
}
|
||||
9
frontend/app/(main)/blogs/page.tsx
Normal file
9
frontend/app/(main)/blogs/page.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import Blog from "@/components/blog";
|
||||
|
||||
export default function History() {
|
||||
return (
|
||||
<div className="flex flex-col">
|
||||
<Blog />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user