From d4bae7f6ba31b3d78beba50250fcf92cdc7e3dff Mon Sep 17 00:00:00 2001 From: Suvodip Ghosh Date: Mon, 20 Feb 2023 23:53:54 +0530 Subject: [PATCH] SingleTheme --- src/pages/themes/[id].astro | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/pages/themes/[id].astro b/src/pages/themes/[id].astro index ef5c993..365acc4 100644 --- a/src/pages/themes/[id].astro +++ b/src/pages/themes/[id].astro @@ -2,7 +2,18 @@ import Layout from "../../layouts/Layout.astro"; import Menu from "../../components/Menu.astro"; -const response = await fetch('https://curriculum-app-api.beanstalkedu.com/items/themes?filter[status][_eq]=published'); +export async function getStaticPaths() { + const response = await fetch('https://management.beanstalkedu.com/items/themes'); + const data = await response.json(); + const finalData = data.data.map((n: { theme_slug: string | undefined; })=>{ + return {params: {id:n.theme_slug}} + }) + return finalData; +} + +const { id } = Astro.params; + +const response = await fetch('https://curriculum-app-api.beanstalkedu.com/items/themes?filter[theme_slug][_eq]='+id); const data = await response.json(); const themes = data.data; @@ -59,12 +70,12 @@ import Footer from "../../components/Footer.vue"; - +
Celebration Ideas
{themes[0].celebration_ideas_text}
- {tciRespData.map((data) => + {tciRespData.map((data: { celebration_ideas_img: string | undefined; celebration_ideas_title: string | undefined; celebration_ideas_body_text: string | undefined; title: string | undefined; }) =>
{data.celebration_ideas_title} @@ -85,7 +96,7 @@ import Footer from "../../components/Footer.vue";
Worksheets
{themes[0].worksheets_text}
- {twsRespData.map((data) => + {twsRespData.map((data: { title: string | undefined; theme_worksheets_img: string | undefined; file: string | undefined; }) =>
@@ -112,7 +123,7 @@ import Footer from "../../components/Footer.vue";
-
+ -
+
YouTube Videos for your reference
{themes[0].youtube_text}
- {ytvRespData.map((data) => + {ytvRespData.map((data: { youtube_id: string | undefined; youtube_thumbnail: string | undefined; about_the_video: string | undefined; }) =>