feat: add jwennAnVedette
This commit is contained in:
+3
-3
@@ -1,7 +1,7 @@
|
||||
import Box from '@mui/material/Box'
|
||||
import Container from '@mui/material/Container'
|
||||
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 Akey from '../components/akey'
|
||||
@@ -12,13 +12,13 @@ import Footer from '../components/footer'
|
||||
import Aso from '../components/akey/aso'
|
||||
|
||||
async function jwennDone() {
|
||||
const [statistik, denyeTeks] = await Promise.all([jwennStats(), jwennDenyeTeks()])
|
||||
const [statistik, denyeTeks, anVedette] = await Promise.all([jwennStats(), jwennDenyeTeks(), jwennAnVedette()])
|
||||
|
||||
if (!statistik) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
return {statistik, dernierTeks: denyeTeks?.[0]}
|
||||
return {statistik, dernierTeks: anVedette ?? denyeTeks?.[0]}
|
||||
}
|
||||
|
||||
export default async function Page() {
|
||||
|
||||
@@ -229,6 +229,25 @@ export async function jwennDenyeTeks() {
|
||||
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) {
|
||||
const headers = {
|
||||
'content-type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user