Improve performance teks page

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-10-30 21:05:21 +04:00
parent b5cfeb276b
commit 8f3620714c
2 changed files with 33 additions and 4 deletions
+31 -1
View File
@@ -13,7 +13,37 @@ const readAxiosInstance = axios.create({
export async function jwennTeksEpiSlug(slug) {
const query = qs.stringify({
populate: ['artistes', 'couverture'],
populate: {
user: {
fields: ['username']
},
userAdmin: {
fields: ['username', 'firstname']
},
commentaires: {
fields: ['contenu', 'datePublication'],
populate: {
user: {
fields: ['username']
}
}
},
couverture: {
populate: '*'
},
artistes: {
fields: ['alias', 'slug']
},
streamAudio: {
populate: '*'
},
streamVideo: {
populate: '*'
},
traductions: {
populate: '*'
}
},
filters: {
slug: {
$eq: slug
+2 -3
View File
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import {getAlias} from '../../lib/utils/format'
import {jwennTeks} from '../../lib/oki-api'
import {jwennTeksEpiSlug} from '../../lib/oki-api'
import HeadLayout from '../../components/head-layout'
import TeksDrawer from '../../components/teks/teks-drawer'
@@ -62,8 +62,7 @@ export async function getServerSideProps({query}) {
let errorMessage
try {
paroles = await jwennTeks()
parole = paroles.find(({attributes}) => attributes.slug === slug)
parole = await jwennTeksEpiSlug(slug)
} catch (error) {
errorMessage = error
hasError = true