angrybeanie-front-end/pages/podcasts/current.js

38 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-12-06 21:49:37 +11:00
import "../../components/main.js"
import Layout from "../../components/main.js"
2021-02-04 14:27:14 +11:00
import Link from 'next/link'
import getConfig from 'next/config'
2021-09-05 16:12:45 +10:00
import Image from 'next/image';
2020-12-06 21:49:37 +11:00
2021-02-04 14:27:14 +11:00
export async function getServerSideProps(context) {
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
const secres = await fetch(serverRuntimeConfig.base_path + `/api/sections`)
2020-12-06 21:49:37 +11:00
const secdata = await secres.json()
2021-02-04 14:27:14 +11:00
const podcastres = await fetch(serverRuntimeConfig.base_path + `/api/podcasts/bystatus/1`)
2020-12-06 21:49:37 +11:00
const podcastdata = await podcastres.json()
const episodedata = "hi there"
2021-02-04 14:27:14 +11:00
const pagedata = {'title': 'Angry Beanie - Current Podcast Projects'}
2020-12-06 21:49:37 +11:00
return {
2021-02-04 14:27:14 +11:00
props: { sections : secdata, podcastdata, episodedata, pagedata }, // will be passed to the page component as props
2020-12-06 21:49:37 +11:00
}
}
2021-02-04 14:27:14 +11:00
const PodcastCurrent = ({sections, podcastdata, episodedata, pagedata}) => (
<Layout sections={sections} episodedata={episodedata} pagedata={pagedata}>
2020-12-06 21:49:37 +11:00
<h1>Current Podcasts</h1>
{podcastdata.shows.map((podcast) => (
2021-09-05 16:12:45 +10:00
<h1><Image
src={"https://www.angrybeanie.com/uploads/media/default/0001/01/thumb_185_default_small.png"}
2021-09-05 16:12:45 +10:00
height=""
width=""
></Image><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></h1>
2020-12-06 21:49:37 +11:00
))}
</Layout>
)
export default PodcastCurrent