$
This commit is contained in:
parent
1db392b2ab
commit
e9a02b90b8
@ -106,6 +106,7 @@
|
||||
* data: Contenant des facets etc...
|
||||
* */
|
||||
state: {
|
||||
api: "",
|
||||
page: {
|
||||
curIndex: 0, // section n.0 -> n.2
|
||||
cat: null,
|
||||
@ -125,7 +126,6 @@
|
||||
try {
|
||||
if(this.state.page.curIndex-1 >= 0) {
|
||||
if(this.state.page.curIndex === 0) {
|
||||
this.debug("finish")
|
||||
} else if(this.state.page.curIndex === 1) {
|
||||
this.getDataSection0(this.state.page.cat)
|
||||
} else if(this.state.page.curIndex === 2) {
|
||||
@ -155,28 +155,25 @@
|
||||
} else if(this.state.page.curIndex === 1) {
|
||||
this.getDataSection2(this.state.page.cat)
|
||||
} else if(this.state.page.curIndex === 2) {
|
||||
this.debug("finish")
|
||||
}
|
||||
|
||||
if(this.state.page.curIndex !== 2) { // Sinon ca va aller trop loin a la section 2
|
||||
this.update({ curIndex: this.state.page.curIndex++ });
|
||||
}
|
||||
}
|
||||
|
||||
this.debug(this.state.page.cat)
|
||||
} catch(e) {
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
|
||||
debug(mess) { console.log(mess) },
|
||||
|
||||
/**
|
||||
* Pour recuperer les données directement depuis l'API avec la facet: "fili"
|
||||
* */
|
||||
async getDataSection0() {
|
||||
try {
|
||||
const api = "https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&sort=tri&facet=fili&timezone=Europe%2FBerlin";
|
||||
const api = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&rows=0&sort=tri` +
|
||||
`&facet=fili&timezone=Europe%2FBerlin`;
|
||||
|
||||
const response = await fetch(api);
|
||||
const data = await response.json();
|
||||
this.update({ data: data.facet_groups[0].facets });
|
||||
@ -185,15 +182,23 @@
|
||||
}
|
||||
},
|
||||
|
||||
async getDataSection1(fili) {
|
||||
const api = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&rows=0&sort=tri&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=${ fili }&timezone=Europe%2FBerlin`
|
||||
async getDataSection1() {
|
||||
const api = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&rows=0&sort=tri` +
|
||||
`&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc` +
|
||||
`&refine.fili=${ this.state.page.cat }` +
|
||||
`&timezone=Europe%2FBerlin`
|
||||
|
||||
const response = await fetch(api);
|
||||
const data = await response.json();
|
||||
this.update({ data: data.facet_groups[1].facets });
|
||||
},
|
||||
async getDataSection2() {
|
||||
const api = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&rows=0&sort=tri` +
|
||||
`&facet=fili&facet=form_lib_voe_acc` +
|
||||
`&facet=fil_lib_voe_acc` +
|
||||
`&refine.fili=${ this.state.page.cat }` +
|
||||
`&timezone=Europe%2FBerlin`
|
||||
|
||||
async getDataSection2(spec) {
|
||||
const api = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&lang=fr&rows=0&sort=tri&facet=fili&facet=form_lib_voe_acc&facet=fil_lib_voe_acc&refine.fili=${ spec }&timezone=Europe%2FBerlin`
|
||||
const response = await fetch(api);
|
||||
const data = await response.json();
|
||||
this.update({ data: data.facet_groups[2].facets });
|
||||
|
Loading…
Reference in New Issue
Block a user