angrybeanie-front-end/pages/podcasts/current.js
2021-09-05 16:12:45 +10:00

38 lines
No EOL
1.4 KiB
JavaScript
Executable file

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