37 lines
779 B
JavaScript
37 lines
779 B
JavaScript
import PropTypes from 'prop-types'
|
|
|
|
import {jwennTeksEpiSlug, jwennTeks} from '../../lib/oki-api'
|
|
|
|
import TeksDrawer from '../../components/teks/teks-drawer'
|
|
import HeadLayout from '../../components/head-layout'
|
|
|
|
export default function SlugTeks({teks, anTeks}) {
|
|
return (
|
|
<HeadLayout title={`Tèks | ${anTeks.tit}`} tab={2}>
|
|
<TeksDrawer teks={teks} anTeks={anTeks} />
|
|
</HeadLayout>
|
|
)
|
|
}
|
|
|
|
export async function getServerSideProps({query}) {
|
|
const {slug} = query
|
|
const teks = await jwennTeks()
|
|
const anTeks = await jwennTeksEpiSlug(slug)
|
|
|
|
if (!anTeks) {
|
|
throw new Error('San répons')
|
|
}
|
|
|
|
return {
|
|
props: {
|
|
teks,
|
|
anTeks
|
|
}
|
|
}
|
|
}
|
|
|
|
SlugTeks.propTypes = {
|
|
teks: PropTypes.array.isRequired,
|
|
anTeks: PropTypes.object.isRequired
|
|
}
|