ajout de la pagination des résultats de recherche

This commit is contained in:
2026-03-18 14:54:01 +01:00
parent 1d9f80e63d
commit 3bbc60fd68
5 changed files with 325 additions and 101 deletions
+7 -4
View File
@@ -1,6 +1,9 @@
export function buildURL(query) {
export function buildURL(query, limit = 20, offset = 0) {
let url =
"https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?limit=10"
"https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?"
url += "limit=" + limit
url += "&offset=" + offset
if (query && query.trim() !== "") {
url += "&where=search(lib_for_voe_ins, '" + query + "')"
@@ -9,8 +12,8 @@ export function buildURL(query) {
return url
}
export async function fetchFormations(query) {
const url = buildURL(query)
export async function fetchFormations(query, limit = 20, offset = 0) {
const url = buildURL(query, limit, offset)
const response = await fetch(url)
if (!response.ok) {