Defining artists per page with env variable

This commit is contained in:
2020-12-12 21:50:16 +01:00
parent fff4abbdff
commit 6ab2ef7870
3 changed files with 8 additions and 3 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
import axios from 'axios'
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
export async function getAwtis() {
const response = await axios.get(`${OKI_API}/awtis`)
@@ -13,8 +14,8 @@ export async function jwennAwtisKantite() {
}
export async function jwennAwtisPajinasyon(paj) {
const start = 8 * (paj - 1)
const query = `_sort=alias:ASC&_start=${start}&_limit=8`
const start = AWTIS_POU_CHAK_PAJ * (paj - 1)
const query = `_sort=alias:ASC&_start=${start}&_limit=${AWTIS_POU_CHAK_PAJ}`
const response = await axios.get(`${OKI_API}/awtis?${query}`)
return response.data