Adapt jwennDenyeTeks query and use qs stringify

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-05-17 09:00:40 +04:00
parent d8b7fd130d
commit 6f7545fdb1
+10 -3
View File
@@ -1,4 +1,5 @@
import axios from 'axios'
import qs from 'qs'
const OKI_API = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:1337'
const AWTIS_POU_CHAK_PAJ = process.env.NEXT_PUBLIC_AWTIS_POU_CHAK_PAJ || 6
@@ -54,10 +55,16 @@ export async function jwennAwtisSlug() {
}
export async function jwennDenyeTeks() {
const query = '_sort=published_at:DESC&_limit=6&_where[published_at_null]=false'
const query = qs.stringify({
populate: ['artistes', 'couverture'],
sort: ['publishedAt:desc'],
pagination: {
limit: 6
}
})
const response = await axios.get(`${OKI_API}/teks?${query}`)
return response.data
const {data} = await readAxiosInstance.get(`${OKI_API}/paroles?${query}`)
return data.data
}
export async function jwennAnTeks(teksId) {