chore: init
This commit is contained in:
32
src/pages/index.astro
Normal file
32
src/pages/index.astro
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
import fetchApi from "../lib/strapi";
|
||||
import type { ArticleData } from "../interfaces/article";
|
||||
|
||||
const articles = await fetchApi<ArticleData[]>({
|
||||
endpoint: "articles?populate=image",
|
||||
wrappedByKey: "data",
|
||||
});
|
||||
|
||||
console.log('Articles response:', articles);
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Blog</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main>
|
||||
<ul>
|
||||
{
|
||||
articles.map((article) => (
|
||||
<li>
|
||||
<a href={`/blog/${article.slug}/`}>{article.title}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user