From cd16938e20859ddcc6ab37fe23c13bf34964dd26 Mon Sep 17 00:00:00 2001 From: Bilou Date: Fri, 31 Mar 2023 16:46:21 +0200 Subject: [PATCH] $ --- src/components/global/api/Model.js | 35 ++++++++++++++++++++---------- src/index.html | 1 - 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/components/global/api/Model.js b/src/components/global/api/Model.js index 72fc9a0..4c7f9f8 100644 --- a/src/components/global/api/Model.js +++ b/src/components/global/api/Model.js @@ -12,7 +12,8 @@ export default class Model { filiaire: "fili", formation: "form_lib_voe_acc", spec: "fil_lib_voe_acc" - } + }, + apikey: "196a5bb3797f9946727688fc65fa0074a64fc0b7140b1cb6a6b4ddde" }, page: { curIndex: 0, /* section n.0 -> n.2. */ @@ -119,7 +120,10 @@ export default class Model { getModelData0() { if(!localStorage.getItem(`sec0`)) { const link = `${ this.state.api.link }&rows=0` + - `&facet=${encodeURIComponent(this.state.api.facet.filiaire)}` + `&facet=${encodeURIComponent(this.state.api.facet.filiaire)}` + + `&apikey=${this.state.api.apikey}` + + console.log(this.state.api.apikey) return fetch(link) .then((res) => res.json()) @@ -152,7 +156,8 @@ export default class Model { `&facet=${encodeURIComponent(this.state.api.facet.filiaire)}` + `&facet=${encodeURIComponent(this.state.api.facet.formation)}` + `&facet=${encodeURIComponent(this.state.api.facet.spec)}` + - `&refine.${encodeURIComponent(this.state.api.facet.filiaire)}=${encodeURIComponent(this.state.page.cat)}` + `&refine.${encodeURIComponent(this.state.api.facet.filiaire)}=${encodeURIComponent(this.state.page.cat)}` + + `&apikey=${this.state.api.apikey}` return fetch(link) .then((res) => res.json()) @@ -187,7 +192,8 @@ export default class Model { `&facet=${encodeURIComponent(this.state.api.facet.formation)}` + `&facet=${encodeURIComponent(this.state.api.facet.spec)}` + `&refine.${encodeURIComponent(this.state.api.facet.filiaire)}=${encodeURIComponent(this.state.page.cat)}` + - `&refine.${encodeURIComponent(this.state.api.facet.formation)}=${encodeURIComponent(this.state.page.scat)}` + `&refine.${encodeURIComponent(this.state.api.facet.formation)}=${encodeURIComponent(this.state.page.scat)}` + + `&apikey=${this.state.api.apikey}` /** * (Bilal prends la responsabilite de ce massacre) @@ -197,7 +203,8 @@ export default class Model { `&facet=${encodeURIComponent(this.state.api.facet.filiaire)}` + `&facet=${encodeURIComponent(this.state.api.facet.formation)}` + `&facet=${encodeURIComponent(this.state.api.facet.spec)}` + - `&refine.fili=Ecole%20d%27Ingénieur&refine.form_lib_voe_acc=Formations%20%20des%20écoles%20d%27ingénieurs` + `&refine.fili=Ecole%20d%27Ingénieur&refine.form_lib_voe_acc=Formations%20%20des%20écoles%20d%27ingénieurs` + + `&apikey=${this.state.api.apikey}` } return fetch(link) @@ -236,15 +243,18 @@ export default class Model { `&facet=${encodeURIComponent(this.state.api.facet.spec)}` + `&refine.${encodeURIComponent(this.state.api.facet.filiaire)}=${encodeURIComponent(this.state.page.cat)}` + `&refine.${encodeURIComponent(this.state.api.facet.formation)}=${encodeURIComponent(this.state.page.scat)}` + - `&refine.${encodeURIComponent(this.state.api.facet.spec)}=${encodeURIComponent(this.state.page.tcat)}` + `&refine.${encodeURIComponent(this.state.api.facet.spec)}=${encodeURIComponent(this.state.page.tcat)}` + + `&apikey=${this.state.api.apikey}` /** * (Bilal prends la responsabilite de ce massacre) * */ if(this.state.page.tcat === "Formation d'ingénieur Bac + 5") { - link = `https://data.enseignementsup-recherche.gouv.fr/explore/embed/dataset/fr-esr-parcoursup/map/?timezone=Europe%2FBerlin&sort=tri&facet=fili&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205` + link = `https://data.enseignementsup-recherche.gouv.fr/explore/embed/dataset/fr-esr-parcoursup/map/?timezone=Europe%2FBerlin&sort=tri&facet=fili&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205` + + `&apikey=${this.state.api.apikey}` } else if(this.state.page.tcat === "Formation Bac + 3") { - link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20Bac%20%2B%203` + link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20Bac%20%2B%203` + + `&apikey=${this.state.api.apikey}` } return fetch(link) @@ -288,7 +298,8 @@ export default class Model { `&refine.${encodeURIComponent(this.state.api.facet.filiaire)}=${encodeURIComponent(this.state.page.cat)}` + `&refine.${encodeURIComponent(this.state.api.facet.formation)}=${encodeURIComponent(this.state.page.scat)}` + `&refine.${encodeURIComponent(this.state.api.facet.spec)}=${encodeURIComponent(this.state.page.tcat)}` + - `&location=6,48.04137,1.74683&basemap=e69ab1` + `&location=6,48.04137,1.74683&basemap=e69ab1` + + `&apikey=${this.state.api.apikey}` console.log(link) @@ -296,9 +307,11 @@ export default class Model { * (Bilal prends la responsabilite de ce massacre) * */ if(this.state.page.tcat === "Formation d'ingénieur Bac + 5") { - link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205&location=6,48.04137,1.74683&basemap=e69ab1` + link = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&sort=tri&rows=10000&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20d%27ing%C3%A9nieur%20Bac%20%2B%205&location=6,48.04137,1.74683&basemap=e69ab1` + + `&apikey=${this.state.api.apikey}` } else if(this.state.page.tcat === "Formation Bac + 3") { - link = `https://data.enseignementsup-recherche.gouv.fr/explore/embed/dataset/fr-esr-parcoursup/map/?timezone=Europe%2FBerlin&sort=tri&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20Bac%20%2B%203&location=6,47.0088,2.09656&basemap=e69ab1&location=6,48.04137,1.74683&basemap=e69ab1` + link = `https://data.enseignementsup-recherche.gouv.fr/explore/embed/dataset/fr-esr-parcoursup/map/?timezone=Europe%2FBerlin&sort=tri&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=Ecole%20d%27Ing%C3%A9nieur&refine.form_lib_voe_acc=Formations%20%20des%20%C3%A9coles%20d%27ing%C3%A9nieurs&refine.fil_lib_voe_acc=Formation%20Bac%20%2B%203&location=6,47.0088,2.09656&basemap=e69ab1&location=6,48.04137,1.74683&basemap=e69ab1` + + `&apikey=${this.state.api.apikey}` } return new Promise((resolve, reject) => { diff --git a/src/index.html b/src/index.html index 803093b..51f5f79 100644 --- a/src/index.html +++ b/src/index.html @@ -6,7 +6,6 @@ -