Add komante to TeksDrawer
This commit is contained in:
+10
-5
@@ -1,6 +1,6 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {jwennTeksEpiSlug, jwennTeks} from '../../lib/oki-api'
|
import {jwennTeksEpiSlug, jwennTeks, jwennKomanteEpiTeksId} from '../../lib/oki-api'
|
||||||
|
|
||||||
import TeksDrawer from '../../components/teks/teks-drawer'
|
import TeksDrawer from '../../components/teks/teks-drawer'
|
||||||
import HeadLayout from '../../components/head-layout'
|
import HeadLayout from '../../components/head-layout'
|
||||||
@@ -9,7 +9,7 @@ const jwennAwtis = awtis => {
|
|||||||
return awtis.map(a => a.alias).join(', ')
|
return awtis.map(a => a.alias).join(', ')
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SlugTeks({teks, anTeks, slug}) {
|
export default function SlugTeks({teks, anTeks, slug, komante}) {
|
||||||
const awtis = anTeks.awtis.length === 1 ? anTeks.awtis[0].alias : jwennAwtis(anTeks.awtis)
|
const awtis = anTeks.awtis.length === 1 ? anTeks.awtis[0].alias : jwennAwtis(anTeks.awtis)
|
||||||
const {kouveti} = anTeks
|
const {kouveti} = anTeks
|
||||||
const formatKouveti = () => {
|
const formatKouveti = () => {
|
||||||
@@ -40,7 +40,7 @@ export default function SlugTeks({teks, anTeks, slug}) {
|
|||||||
imageMime={formatKouveti() ? formatKouveti().mime : null}
|
imageMime={formatKouveti() ? formatKouveti().mime : null}
|
||||||
title={`${awtis} - ${anTeks.tit}`} tab={2} slug={`teks/${slug}`}
|
title={`${awtis} - ${anTeks.tit}`} tab={2} slug={`teks/${slug}`}
|
||||||
>
|
>
|
||||||
<TeksDrawer teks={teks} anTeks={anTeks} />
|
<TeksDrawer teks={teks} anTeks={anTeks} komante={komante} />
|
||||||
</HeadLayout>
|
</HeadLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -54,11 +54,15 @@ export async function getServerSideProps({query}) {
|
|||||||
throw new Error('San répons')
|
throw new Error('San répons')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {_id} = anTeks
|
||||||
|
const komante = await jwennKomanteEpiTeksId(_id)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
teks,
|
teks,
|
||||||
anTeks,
|
anTeks,
|
||||||
slug
|
slug,
|
||||||
|
komante
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,5 +70,6 @@ export async function getServerSideProps({query}) {
|
|||||||
SlugTeks.propTypes = {
|
SlugTeks.propTypes = {
|
||||||
teks: PropTypes.array.isRequired,
|
teks: PropTypes.array.isRequired,
|
||||||
anTeks: PropTypes.object.isRequired,
|
anTeks: PropTypes.object.isRequired,
|
||||||
slug: PropTypes.string.isRequired
|
slug: PropTypes.string.isRequired,
|
||||||
|
komante: PropTypes.array.isRequired
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user