feat: add jwennAnVedette
This commit is contained in:
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import Box from '@mui/material/Box'
|
import Box from '@mui/material/Box'
|
||||||
import Container from '@mui/material/Container'
|
import Container from '@mui/material/Container'
|
||||||
import {notFound} from 'next/navigation'
|
import {notFound} from 'next/navigation'
|
||||||
import {jwennStats, jwennDenyeTeks} from '../lib/oki-api'
|
import {jwennStats, jwennDenyeTeks, jwennAnVedette} from '../lib/oki-api'
|
||||||
|
|
||||||
import Statistik from '../components/akey/statistik'
|
import Statistik from '../components/akey/statistik'
|
||||||
import Akey from '../components/akey'
|
import Akey from '../components/akey'
|
||||||
@@ -12,13 +12,13 @@ import Footer from '../components/footer'
|
|||||||
import Aso from '../components/akey/aso'
|
import Aso from '../components/akey/aso'
|
||||||
|
|
||||||
async function jwennDone() {
|
async function jwennDone() {
|
||||||
const [statistik, denyeTeks] = await Promise.all([jwennStats(), jwennDenyeTeks()])
|
const [statistik, denyeTeks, anVedette] = await Promise.all([jwennStats(), jwennDenyeTeks(), jwennAnVedette()])
|
||||||
|
|
||||||
if (!statistik) {
|
if (!statistik) {
|
||||||
notFound()
|
notFound()
|
||||||
}
|
}
|
||||||
|
|
||||||
return {statistik, dernierTeks: denyeTeks?.[0]}
|
return {statistik, dernierTeks: anVedette ?? denyeTeks?.[0]}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
|
|||||||
@@ -229,6 +229,25 @@ export async function jwennDenyeTeks() {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function jwennAnVedette() {
|
||||||
|
const query = qs.stringify({
|
||||||
|
populate: ['artistes', 'couverture'],
|
||||||
|
filters: {
|
||||||
|
isNewRelease: { $eq: true }
|
||||||
|
},
|
||||||
|
pagination: { limit: 1 }
|
||||||
|
}, {
|
||||||
|
encodeValuesOnly: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const {data} = await request(`/paroles?${query}`, {
|
||||||
|
next: {revalidate: 0},
|
||||||
|
headers: {Authorization: `Bearer ${readToken}`}
|
||||||
|
})
|
||||||
|
|
||||||
|
return data?.[0] ?? null
|
||||||
|
}
|
||||||
|
|
||||||
export async function jwennAnTeks(teksId, token) {
|
export async function jwennAnTeks(teksId, token) {
|
||||||
const headers = {
|
const headers = {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
|
|||||||
Reference in New Issue
Block a user