2020-12-11 01:35:49 +01:00
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
|
|
const OKI_API = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:1337'
|
2020-12-12 21:50:16 +01:00
|
|
|
const AWTIS_POU_CHAK_PAJ = process.env.NEXT_PUBLIC_AWTIS_POU_CHAK_PAJ || 6
|
2020-12-11 01:35:49 +01:00
|
|
|
|
2020-12-18 21:55:14 +01:00
|
|
|
export async function jwennTeksEpiSlug(slug) {
|
2020-12-23 20:38:15 +01:00
|
|
|
const response = await axios.get(`${OKI_API}/teks?slug=${slug}&_where[published_at_null]=false`)
|
2020-12-18 21:55:14 +01:00
|
|
|
return response.data[0]
|
2020-12-11 01:35:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function jwennAwtisKantite() {
|
2020-12-23 20:29:04 +01:00
|
|
|
const response = await axios.get(`${OKI_API}/awtis/count?_where[published_at_null]=false`)
|
2020-12-11 01:35:49 +01:00
|
|
|
return response.data
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-23 20:29:59 +01:00
|
|
|
export async function jwennTeksKantite() {
|
|
|
|
|
const response = await axios.get(`${OKI_API}/teks/count?_where[published_at_null]=false`)
|
|
|
|
|
return response.data
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-11 01:35:49 +01:00
|
|
|
export async function jwennAwtisPajinasyon(paj) {
|
2020-12-12 21:50:16 +01:00
|
|
|
const start = AWTIS_POU_CHAK_PAJ * (paj - 1)
|
2020-12-23 20:38:15 +01:00
|
|
|
const query = `_sort=alias:ASC&_start=${start}&_limit=${AWTIS_POU_CHAK_PAJ}&_where[published_at_null]=false`
|
2020-12-11 01:35:49 +01:00
|
|
|
|
|
|
|
|
const response = await axios.get(`${OKI_API}/awtis?${query}`)
|
|
|
|
|
return response.data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function jwennTeks() {
|
2020-12-23 20:38:15 +01:00
|
|
|
const query = '_sort=tit:ASC&_where[published_at_null]=false'
|
2020-12-13 23:10:03 +01:00
|
|
|
|
2020-12-18 21:55:14 +01:00
|
|
|
const response = await axios.get(`${OKI_API}/teks?${query}`)
|
2020-12-11 01:35:49 +01:00
|
|
|
return response.data
|
|
|
|
|
}
|
2020-12-21 03:22:05 +01:00
|
|
|
|
|
|
|
|
export async function jwennSlugs() {
|
|
|
|
|
const response = await axios.get(`${OKI_API}/slugs`)
|
|
|
|
|
return response.data
|
|
|
|
|
}
|