diff --git a/src/components/global/selector/selector.riot b/src/components/global/selector/selector.riot index 96595ed..b7e6eb1 100644 --- a/src/components/global/selector/selector.riot +++ b/src/components/global/selector/selector.riot @@ -112,13 +112,10 @@ filiaire: "fili", formation: "form_lib_voe_acc", spec: "fil_lib_voe_acc" - }, - rafine: { - } }, page: { - curIndex: 0, // section n.0 -> n.2. + curIndex: 0, /* section n.0 -> n.2. */ cat: null, name: [ "formation", @@ -132,7 +129,7 @@ /** * Retourner a la section n-1. * */ - previousPage(event){ + previousPage(){ try { if(this.state.page.curIndex-1 >= 0) { if(this.state.page.curIndex === 0) { @@ -142,7 +139,7 @@ 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-- }); } } @@ -167,7 +164,7 @@ } 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++ }); } } @@ -187,6 +184,7 @@ const response = await fetch(link); const data = await response.json(); + this.update({ data: data.facet_groups[0].facets }); } catch (e) { console.error(e); @@ -199,10 +197,11 @@ `&facet=${ this.state.api.facet.filiaire }` + `&facet=${ this.state.api.facet.formation }` + `&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 data = await response.json(); + this.update({ data: data.facet_groups[1].facets }); } catch (e) { console.error(e); @@ -215,10 +214,11 @@ `&facet=${ this.state.api.facet.filiaire }` + `&facet=${ this.state.api.facet.formation }` + `&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 data = await response.json(); + this.update({ data: data.facet_groups[2].facets }); } catch (e) { console.error(e);