Improve performance teks page
This commit is contained in:
+31
-1
@@ -13,7 +13,37 @@ const readAxiosInstance = axios.create({
|
|||||||
|
|
||||||
export async function jwennTeksEpiSlug(slug) {
|
export async function jwennTeksEpiSlug(slug) {
|
||||||
const query = qs.stringify({
|
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: {
|
filters: {
|
||||||
slug: {
|
slug: {
|
||||||
$eq: slug
|
$eq: slug
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {getAlias} from '../../lib/utils/format'
|
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 HeadLayout from '../../components/head-layout'
|
||||||
import TeksDrawer from '../../components/teks/teks-drawer'
|
import TeksDrawer from '../../components/teks/teks-drawer'
|
||||||
@@ -62,8 +62,7 @@ export async function getServerSideProps({query}) {
|
|||||||
let errorMessage
|
let errorMessage
|
||||||
|
|
||||||
try {
|
try {
|
||||||
paroles = await jwennTeks()
|
parole = await jwennTeksEpiSlug(slug)
|
||||||
parole = paroles.find(({attributes}) => attributes.slug === slug)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
errorMessage = error
|
errorMessage = error
|
||||||
hasError = true
|
hasError = true
|
||||||
|
|||||||
Reference in New Issue
Block a user