Yea
This commit is contained in:
+15
-4
@@ -6,9 +6,18 @@ import ArticlePreview from "@/components/news/article-preview"
|
||||
import ReactDOM from "react";
|
||||
import "public/global.css"
|
||||
import "./index.css"
|
||||
import { Post } from "@/model/sequelize/NewModels";
|
||||
|
||||
type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
} : T;
|
||||
|
||||
export default async function Test() {
|
||||
|
||||
const response = await fetch("http://localhost:3000/api2/post/");
|
||||
const articles:Array<DeepPartial<Post>> = await response.json();
|
||||
|
||||
|
||||
export default function Test() {
|
||||
return <div className={`root`}>
|
||||
<Header/>
|
||||
<Navbar/>
|
||||
@@ -20,9 +29,11 @@ export default function Test() {
|
||||
<ul><li>filter 1</li><li>filter 2</li><li>filter 3</li></ul>
|
||||
</Sidebar>
|
||||
<main>
|
||||
<ArticlePreview/>
|
||||
<ArticlePreview/>
|
||||
<ArticlePreview/>
|
||||
{articles.map((article, i) => {
|
||||
console.log("Entered");
|
||||
// Return the element. Also pass key
|
||||
return (<ArticlePreview id={article?.id?.toString()} content={article?.content} title={article?.title}></ArticlePreview>)
|
||||
})}
|
||||
</main>
|
||||
</PageContainer>
|
||||
</div>;
|
||||
|
||||
Reference in New Issue
Block a user