first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export function buildURL(query) {
|
||||
let url =
|
||||
"https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-parcoursup/records?limit=10"
|
||||
|
||||
if (query && query.trim() !== "") {
|
||||
url += "&where=search(lib_for_voe_ins, '" + query + "')"
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
export async function fetchFormations(query) {
|
||||
const url = buildURL(query)
|
||||
const response = await fetch(url)
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Erreur HTTP")
|
||||
}
|
||||
|
||||
return await response.json()
|
||||
}
|
||||
Reference in New Issue
Block a user