import { Badge, Page, Text } from "@geist-ui/core"; import { GetServerSidePropsContext } from "next" import Document from '../../components/document' import Header from "../../components/header"; import VisibilityBadge from "../../components/visibility-badge"; import { ThemeProps } from "../_app"; type Props = ThemeProps & { post: any } const Post = ({ post, theme, changeTheme }: Props) => { if (!post.files) { return
No files
} return (
{post.title} { post.files.map(({ id, content, title }: { id: any, content: string, title: string }) => ( )) } ) } export default Post export async function getServerSideProps(context: GetServerSidePropsContext) { const { id } = context.query; const response = await fetch(`http://localhost:3000/posts/${id}`); const json = await response.json(); return { props: { post: json }, } }