@@ -80,18 +80,21 @@ export default class QuestForm extends Component {
80
80
const snippets = JSON .parse (window .localStorage .getItem (LOCAL_STORAGE_KEY )) ?? {
81
81
objectRequirementsByLabel: {},
82
82
};
83
- const eligibilityRequirements = this .popToRootToPip (
83
+ const eligibilityRequirements = this .buildArrayRequirement (
84
84
this .eligibilityRequirementsStr ,
85
85
snippets .objectRequirementsByLabel ,
86
86
);
87
87
88
- const successRequirements = this .popToRootToPip (this .successRequirementsStr , snippets .objectRequirementsByLabel );
88
+ const successRequirements = this .buildArrayRequirement (
89
+ this .successRequirementsStr ,
90
+ snippets .objectRequirementsByLabel ,
91
+ );
89
92
90
93
const questToJson = JSON .stringify ({
91
94
rewardId: parseInt (this .rewardId ),
92
95
rewardType: this .rewardType ,
93
- eligibilityRequirements: [ eligibilityRequirements] ,
94
- successRequirements: successRequirements ? [successRequirements] : [] ,
96
+ eligibilityRequirements: eligibilityRequirements,
97
+ successRequirements: successRequirements,
95
98
});
96
99
97
100
console .log (questToJson);
@@ -121,7 +124,7 @@ export default class QuestForm extends Component {
121
124
ALL(ONE-OF(A,B),C) ---> Le jeton d'opération (all ou one-of) se trouve au début, et en arguments
122
125
on trouve la liste des opérandes.
123
126
*/
124
- popToRootToPip (str , objectRequirementsByLabel ) {
127
+ buildArrayRequirement (str , objectRequirementsByLabel ) {
125
128
// Dictionnaire des "mots" qui correspondent à des requirements feuilles
126
129
// qu'on pourrait retrouver dans la formule
127
130
const snippetNames = Object .keys (objectRequirementsByLabel);
@@ -248,7 +251,7 @@ export default class QuestForm extends Component {
248
251
</PixButtonLink >
249
252
250
253
<PixButton @ size =" small" @ variant =" success" @ triggerAction ={{this .copyEligibilityRequirementsToClipboard }} >
251
- Mettre le json des requirements d'éligibilité dans le presse-papiers
254
+ Copiez le JSON de quête dans le presse-papiers
252
255
</PixButton >
253
256
</div >
254
257
</section >
0 commit comments