'use server'; import React from 'react'; import Markdown from 'react-markdown'; import { Card, CardBody } from '@nextui-org/card'; import remarkGfm from 'remark-gfm'; import rehypeHighlight from 'rehype-highlight'; import rehypeSanitize from 'rehype-sanitize'; import rehypeRaw from 'rehype-raw'; import remarkToc from 'remark-toc'; import remarkFrontmatter from 'remark-frontmatter'; import axios from 'axios'; type Props = { id: string } async function Generate(props: Props) { let response: any; try { response = await axios(`http://localhost:${ process.env.BACKEND_PORT }/api/get/post/${ props.id }`); } catch (e) { return ( Fatal: Failed to load the post. ); } let post_data = response.data; return (
{ (post_data as any)['content'] }
); } export default Generate;