generated from dwd/boilarplate-astro-tailwind
Akademy Landing MPA
This commit is contained in:
20
src/pages/blogs/index.astro
Normal file
20
src/pages/blogs/index.astro
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import AllBlogs from "../../components/Blogs/index";
|
||||
|
||||
const BLOG_API_URL = "https://curriculum-app-api.beanstalkedu.com/items/blog";
|
||||
let blogs = [];
|
||||
|
||||
try {
|
||||
const response = await fetch(`${BLOG_API_URL}?filter[status][_eq]=published&filter[property][_eq]=aKadmy`);
|
||||
const data = await response.json();
|
||||
blogs = data.data || [];
|
||||
console.log("Fetched blogs:", blogs[0].slug);
|
||||
} catch (error) {
|
||||
console.error("Error fetching blogs:", error);
|
||||
blogs = [];
|
||||
}
|
||||
---
|
||||
<Layout title="Akademy Landing - Blogs">
|
||||
<AllBlogs client:only="react" />
|
||||
</Layout>
|
||||
Reference in New Issue
Block a user