angrybeanie-front-end/pages/podcasts/current.js
2021-02-04 14:27:14 +11:00

33 lines
No EOL
1.1 KiB
JavaScript

import "../../components/main.js"
import Layout from "../../components/main.js"
import Link from 'next/link'
import getConfig from 'next/config'
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><Link href={"/podcasts/shows/" + podcast.slug}>{podcast.title}</Link></h1>
))}
</Layout>
)
export default PodcastCurrent