import Head from 'next/head';
import { getStory } from '../lib/aws';
interface Story {
description: string;
title: string;
audioURL: string;
thumbnail?: string;
}
interface PageProps {
story: Story;
}
const story = ({ story }: PageProps) => {
return (
<>
AIStory | {story.title}
{/**/}
{story.title}
{story.description.split('\n\n').map((item) => (
{item}
))}
>
);
};
export async function getServerSideProps(context: any) {
// Get info from DDB table
const {
query: { id = '' },
} = context;
if (!id) {
return {
notFound: true,
};
}
const story = await getStory(id);
if (!story) {
return {
notFound: true,
};
}
return { props: { story } };
}
export default story;