Improve performance teks page
This commit is contained in:
+31
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user