This commit is contained in:
pro.boooooo 2023-03-07 05:16:04 +01:00
parent a2069d4e28
commit fd89dd02b8

View File

@ -112,13 +112,10 @@
filiaire: "fili", filiaire: "fili",
formation: "form_lib_voe_acc", formation: "form_lib_voe_acc",
spec: "fil_lib_voe_acc" spec: "fil_lib_voe_acc"
},
rafine: {
} }
}, },
page: { page: {
curIndex: 0, // section n.0 -> n.2. curIndex: 0, /* section n.0 -> n.2. */
cat: null, cat: null,
name: [ name: [
"formation", "formation",
@ -132,7 +129,7 @@
/** /**
* Retourner a la section n-1. * Retourner a la section n-1.
* */ * */
previousPage(event){ previousPage(){
try { try {
if(this.state.page.curIndex-1 >= 0) { if(this.state.page.curIndex-1 >= 0) {
if(this.state.page.curIndex === 0) { if(this.state.page.curIndex === 0) {
@ -142,7 +139,7 @@
this.getDataSection1(this.state.page.cat) this.getDataSection1(this.state.page.cat)
} }
if(this.state.page.curIndex !== 0) { // Sinon ca va aller trop loin a la section 0. if(this.state.page.curIndex !== 0) { /* Sinon ca va aller trop loin a la section 0. */
this.update({ curIndex: this.state.page.curIndex-- }); this.update({ curIndex: this.state.page.curIndex-- });
} }
} }
@ -167,7 +164,7 @@
} else if(this.state.page.curIndex === 2) { } else if(this.state.page.curIndex === 2) {
} }
if(this.state.page.curIndex !== 2) { // Sinon ca va aller trop loin a la section 2. if(this.state.page.curIndex !== 2) { /* Sinon ca va aller trop loin a la section 2. */
this.update({ curIndex: this.state.page.curIndex++ }); this.update({ curIndex: this.state.page.curIndex++ });
} }
} }
@ -187,6 +184,7 @@
const response = await fetch(link); const response = await fetch(link);
const data = await response.json(); const data = await response.json();
this.update({ data: data.facet_groups[0].facets }); this.update({ data: data.facet_groups[0].facets });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -199,10 +197,11 @@
`&facet=${ this.state.api.facet.filiaire }` + `&facet=${ this.state.api.facet.filiaire }` +
`&facet=${ this.state.api.facet.formation }` + `&facet=${ this.state.api.facet.formation }` +
`&facet=${ this.state.api.facet.spec }` + `&facet=${ this.state.api.facet.spec }` +
`&refine.fili=${ this.state.page.cat }` `&refine.${this.state.api.facet.filiaire}=${ this.state.page.cat }`
const response = await fetch(link); const response = await fetch(link);
const data = await response.json(); const data = await response.json();
this.update({ data: data.facet_groups[1].facets }); this.update({ data: data.facet_groups[1].facets });
} catch (e) { } catch (e) {
console.error(e); console.error(e);
@ -215,10 +214,11 @@
`&facet=${ this.state.api.facet.filiaire }` + `&facet=${ this.state.api.facet.filiaire }` +
`&facet=${ this.state.api.facet.formation }` + `&facet=${ this.state.api.facet.formation }` +
`&facet=${ this.state.api.facet.spec }` + `&facet=${ this.state.api.facet.spec }` +
`&refine.fili=${ this.state.page.cat }` `&refine.${this.state.api.facet.filiaire}=${ this.state.page.cat }`
const response = await fetch(api); const response = await fetch(api);
const data = await response.json(); const data = await response.json();
this.update({ data: data.facet_groups[2].facets }); this.update({ data: data.facet_groups[2].facets });
} catch (e) { } catch (e) {
console.error(e); console.error(e);