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

30 lines
952 B
JavaScript
Raw Normal View History

2020-12-06 21:49:37 +11:00
import "../../components/main.js"
import LatestEpisodes from "../../components/latestepisodes.js"
import Layout from "../../components/main.js"
export async function getStaticProps(context) {
const secres = await fetch(`http://localhost:8000/api/sections`)
const secdata = await secres.json()
const podcastres = await fetch(`http://localhost:8000/api/podcasts/bystatus/1`)
const podcastdata = await podcastres.json()
const episodedata = "hi there"
return {
props: { sections : secdata, podcastdata, episodedata }, // will be passed to the page component as props
}
}
const PodcastCurrent = ({sections, podcastdata, episodedata}) => (
<Layout sections={sections} episodedata={episodedata}>
<LatestEpisodes></LatestEpisodes>
<h1>Current Podcasts</h1>
{podcastdata.shows.map((podcast) => (
<h1>{podcast.title}</h1>
))}
</Layout>
)
export default PodcastCurrent