import FunctionTabs from '../../components/FunctionPage/FunctionTabs' import FunctionForm from '../../components/FunctionPage/FunctionForm' import FunctionArticle from '../../components/FunctionPage/FunctionArticle' import FunctionComments from '../../components/FunctionPage/FunctionComments/FunctionComments' import FunctionPage from '../../components/FunctionPage/FunctionPage' import redirect from '../../utils/redirect' import api from '../../utils/api' const FunctionTabManager = props => { if (props.type === 'form') { return (
) } return (
) } const FunctionComponent = props => ( ) export async function getServerSideProps (context) { const { slug } = context.params return api .get(`/functions/${slug}`) .then(response => ({ props: response.data })) .catch(() => redirect(context, '/404')) } export default FunctionComponent