2021-09-29 21:25:05 +10:00
|
|
|
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()
|
|
|
|
|
|
2022-06-22 21:37:22 +10:00
|
|
|
const currpodcastres = await fetch(serverRuntimeConfig.base_path + `podcast-series?filters[status][$eq]=true`, {
|
2022-06-12 15:12:28 +10:00
|
|
|
headers: new Headers({
|
|
|
|
|
'Authorization': serverRuntimeConfig.strapi_token,
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
|
})
|
|
|
|
|
})
|
2021-09-30 21:10:11 +10:00
|
|
|
const currpodcastdata = await currpodcastres.json()
|
2022-06-12 15:12:28 +10:00
|
|
|
const currpodcastlist = currpodcastdata.data
|
2021-09-30 21:10:11 +10:00
|
|
|
|
2022-06-12 15:12:28 +10:00
|
|
|
console.log(currpodcastlist)
|
|
|
|
|
|
2022-06-22 21:37:22 +10:00
|
|
|
const archpodcastres = await fetch(serverRuntimeConfig.base_path + `podcast-series?filters[status][$eq]=false`, {
|
2022-06-12 15:12:28 +10:00
|
|
|
headers: new Headers({
|
|
|
|
|
'Authorization': serverRuntimeConfig.strapi_token,
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
|
})
|
|
|
|
|
})
|
2021-09-30 21:10:11 +10:00
|
|
|
const archpodcastdata = await archpodcastres.json()
|
2022-06-12 15:12:28 +10:00
|
|
|
const archpodcastlist = archpodcastdata.data
|
2021-09-29 21:25:05 +10:00
|
|
|
|
|
|
|
|
const episodedata = "hi there"
|
|
|
|
|
|
|
|
|
|
const pagedata = {'title': 'Angry Beanie - Current Podcast Projects'}
|
|
|
|
|
|
|
|
|
|
return {
|
2022-06-12 15:12:28 +10:00
|
|
|
props: { sections : secdata, currpodcastlist, archpodcastlist, episodedata, pagedata, serverRuntimeConfig }, // will be passed to the page component as props
|
2021-09-29 21:25:05 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-12 15:12:28 +10:00
|
|
|
const Podcasts = ({sections, currpodcastlist, archpodcastlist, episodedata, pagedata, serverRuntimeConfig}) => (
|
2021-09-30 21:10:11 +10:00
|
|
|
<Layout sections={sections} episodedata={episodedata} pagedata={pagedata} serverRuntimeConfig>
|
|
|
|
|
<h1>Podcasts</h1>
|
|
|
|
|
<div className="page_body">Over the years I have made a number of podcasts.</div>
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="col-sm-6">
|
|
|
|
|
<h2>Current Podcasts</h2>
|
2022-06-12 15:12:28 +10:00
|
|
|
{currpodcastlist.map((podcast) => (
|
|
|
|
|
<div>
|
|
|
|
|
{/* <Image
|
2021-09-30 21:10:11 +10:00
|
|
|
src={serverRuntimeConfig.base_path + "/" + podcast.logo.src}
|
|
|
|
|
height={podcast.logo.height}
|
|
|
|
|
width={podcast.logo.width}
|
2022-06-12 15:12:28 +10:00
|
|
|
></Image> */}
|
|
|
|
|
<Link href={"/podcasts/shows/" + podcast.attributes.Slug}>{podcast.attributes.Title}</Link></div>
|
2021-09-30 21:10:11 +10:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="col-sm-6">
|
|
|
|
|
<h2>Archived Podcasts</h2>
|
2022-06-12 15:12:28 +10:00
|
|
|
{archpodcastlist.map((podcast) => (
|
|
|
|
|
<div>
|
|
|
|
|
{/* <Image
|
2021-09-30 21:10:11 +10:00
|
|
|
src={serverRuntimeConfig.base_path + "/" + podcast.logo.src}
|
|
|
|
|
height={podcast.logo.height}
|
|
|
|
|
width={podcast.logo.width}
|
2022-06-12 15:12:28 +10:00
|
|
|
></Image> */}
|
|
|
|
|
<Link href={"/podcasts/shows/" + podcast.Slug}>{podcast.Title}</Link></div>
|
2021-09-30 21:10:11 +10:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Layout>
|
2021-09-29 21:25:05 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
export default Podcasts
|