Many Changes
This commit is contained in:
+9
-9
@@ -1,14 +1,15 @@
|
||||
import Header from "@/components/header";
|
||||
import PageContainer from "@/components/page-container";
|
||||
import Navbar from "@/components/navbar";
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import ArticlePreview from "@/components/news/article-preview"
|
||||
import Header from "@/components/shared/header";
|
||||
import PageContainer from "@/components/shared/page-container";
|
||||
import Navbar from "@/components/shared/navbar";
|
||||
import Sidebar from "@/components/shared/sidebar";
|
||||
import ArticlePreview from "@/components/shared/news/article-preview"
|
||||
import ReactDOM from "react";
|
||||
import "/public/global.css"
|
||||
import "./index.css"
|
||||
import { Post, PostAttributes } from "@/model/sequelize/NewModels";
|
||||
import { Post } from "@/model/Post";
|
||||
import { constructAPIUrl } from "@/util/Utils";
|
||||
import Link from "next/link";
|
||||
import { Attributes } from "@sequelize/core";
|
||||
|
||||
type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
@@ -18,7 +19,7 @@ export default async function Test() {
|
||||
|
||||
const response = await fetch(constructAPIUrl('post'));
|
||||
|
||||
const articles:Array<DeepPartial<PostAttributes>> = await response.json();
|
||||
const articles:Array<Attributes<Post>> = await response.json();
|
||||
|
||||
return <div className={`root`}>
|
||||
<Header/>
|
||||
@@ -32,9 +33,8 @@ export default async function Test() {
|
||||
</Sidebar> */}
|
||||
<main>
|
||||
{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>)
|
||||
return (<ArticlePreview key={article?.id} id={article?.id?.toString()} content={article?.content} title={article?.title}></ArticlePreview>)
|
||||
})}
|
||||
</main>
|
||||
</PageContainer>
|
||||
|
||||
Reference in New Issue
Block a user