Skip to content

Commit

Permalink
Fix homepage fetching issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudcolas committed Sep 3, 2024
1 parent 48a107d commit a3c212b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion frontend/app/Components/BlogPage/BlogHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const BlogHeader = ({ page }) => {
{page.title}
</h1>
<div className="flex flex-row items-center justify-between md:py-10 py-5 pr-6">
<p className="text-black md:text-lg text-base">{page.author.name}</p>
{page.author ? (
<p className="text-black md:text-lg text-base">{page.author.name}</p>
) : null}
<time className="md:text-lg text-black text-base">
{page.publication_date}
</time>
Expand Down
5 changes: 0 additions & 5 deletions frontend/app/blog/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ export default async function Home() {
type: 'blog.BlogIndexPage',
slug: 'blog',
})}`,
{
headers: {
Accept: 'application/json',
},
},
).then((response) => response.json());

const index = indexPages.items[0];
Expand Down
9 changes: 7 additions & 2 deletions frontend/app/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import HomePage from '@/app/components/HomePage/HomePage';
import HomePage from '@/app/Components/HomePage/HomePage';

export default async function Home() {
const data = await fetch(
'http://localhost:8000/api/v2/pages/?type=home.HomePage&fields=*',
).then((response) => response.json());
const page = data.items[0];

export default function Home({ page }) {
return <HomePage page={page} />;
}

0 comments on commit a3c212b

Please sign in to comment.