ajout de la pagination des résultats de recherche
This commit is contained in:
+7
-4
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user