Show announcements on index page.

master
Icedream 2021-01-03 18:44:30 +01:00
parent 0184eff590
commit 309f8a3afc
1 changed files with 12 additions and 3 deletions

View File

@ -11,17 +11,18 @@ import { VideoOnDemandIndex } from '../util/datatypes/VideoOnDemandIdentifier';
import { getIndex } from '../util/api';
export async function getServerSideProps() {
// Fetch VOD IDs
const { ids } = await getIndex();
// Fetch VOD IDs and announcements
const { announcements, ids } = await getIndex();
return {
props: {
announcements,
ids,
},
};
}
export default function Home({ ids }: VideoOnDemandIndex) {
export default function Home({ announcements, ids }: VideoOnDemandIndex) {
const intl = useIntl();
return (
<div>
@ -62,6 +63,14 @@ export default function Home({ ids }: VideoOnDemandIndex) {
/>
</p>
{
announcements.map(announcement => (
<p>
<b>Announcement:</b> {announcement}
</p>
))
}
<ListGroup>
{ids.map(({ id, title }) => (
<Link key={id} passHref href="/[id]" as={`/${id}`}>