Files
pawol.nu/pages/teks/[slug].js
T

37 lines
779 B
JavaScript
Raw Normal View History

import PropTypes from 'prop-types'
2020-12-18 22:08:34 +01:00
import {jwennTeksEpiSlug, jwennTeks} from '../../lib/oki-api'
import TeksDrawer from '../../components/teks/teks-drawer'
2020-12-15 23:46:05 +01:00
import HeadLayout from '../../components/head-layout'
2020-12-18 22:08:34 +01:00
export default function SlugTeks({teks, anTeks}) {
return (
2020-12-18 22:08:34 +01:00
<HeadLayout title={`Tèks | ${anTeks.tit}`} tab={2}>
<TeksDrawer teks={teks} anTeks={anTeks} />
2020-12-15 23:46:05 +01:00
</HeadLayout>
)
}
export async function getServerSideProps({query}) {
const {slug} = query
2020-12-18 22:08:34 +01:00
const teks = await jwennTeks()
const anTeks = await jwennTeksEpiSlug(slug)
2020-12-18 22:08:34 +01:00
if (!anTeks) {
throw new Error('San répons')
}
return {
props: {
2020-12-18 22:08:34 +01:00
teks,
anTeks
}
}
}
2020-12-18 22:08:34 +01:00
SlugTeks.propTypes = {
teks: PropTypes.array.isRequired,
anTeks: PropTypes.object.isRequired
}