diff --git a/src/components/NewsComp.astro b/src/components/NewsComp.astro index 70827e6..71eec13 100644 --- a/src/components/NewsComp.astro +++ b/src/components/NewsComp.astro @@ -1,5 +1,6 @@ --- -import H2 from './H2.astro'; +import H2 from "./H2.astro"; + interface Article { id: number; meta: { @@ -25,18 +26,16 @@ interface Article { } type Props = { - articleLimit?: number; + articleLimit?: number; }; const { articleLimit = 0 } = Astro.props; const fetchArticles = async (): Promise => { const baseurl = `${import.meta.env.API_URL}api/v2/news/?fields=title,tags,first_published_at,main_image&order=-first_published_at`; - - const validLimit = articleLimit >= 1 ? `&limit=${articleLimit}` : ''; - - const response = await fetch( - `${baseurl}${validLimit}`, - ); + + const validLimit = articleLimit >= 1 ? `&limit=${articleLimit}` : ""; + + const response = await fetch(`${baseurl}${validLimit}`); const data = await response.json(); const articles: Article[] = data.items; return articles; @@ -63,23 +62,24 @@ const articles = await fetchArticles();

{article.title}

- {article.main_image && {article.main_image.alt}} + {article.main_image && ( + {article.main_image.alt} + )} )) diff --git a/src/pages/news/index.astro b/src/pages/news/index.astro index c1268bd..fb20333 100644 --- a/src/pages/news/index.astro +++ b/src/pages/news/index.astro @@ -1,12 +1,11 @@ --- -import Main from '../../components/Main.astro'; -import NewsComp from '../../components/NewsComp.astro'; -import Layout from '../../layouts/Layout.astro'; +import Main from "../../components/Main.astro"; +import NewsComp from "../../components/NewsComp.astro"; +import Layout from "../../layouts/Layout.astro"; --- - - -
- -
-
\ No newline at end of file + +
+ +
+