1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
const title = document.getElementById('title');
const description = document.getElementById('description');
const answer = document.getElementById('answer');
const supportExchanges = document.getElementById('supportExchanges');
if (text.value.length > 0) {
// FIXME: Supprimer data quand on fera appel à l'API Flask
const data = "data/predictions.json";
const json = { "instances": [ text.value ] };
console.log("Json instances : ", json);
app.getJSON(json, data, API_URL);
} else if (title.value.length > 0){
var value = title.value;
const data = "data/predictions.json";
const json = { "instances" : [{"title" : value}]};
console.log("Json instances : ", json);
app.getJSON(json, data, API_URL);
} else if (description.value.length > 0){
var value = description.value;
const data = "data/predictions.json";
const json = { "instances" : [{"description" : value}]};
console.log("Json instances : ", json);
app.getJSON(json, data, API_URL);
} else if (answer.value.length > 0){
var value = answer.value;
const data = "data/predictions.json";
const json = { "instances" : [{"answer" : value}]};
console.log("Json instances : ", json);
app.getJSON(json, data, API_URL);
} else if (supportExchanges.value.length > 0){
var value = supportExchanges.value;
const data = "data/predictions.json";
const json = { "instances" : [{"supportExchanges" : value}]};
console.log("Json instances : ", json);
app.getJSON(json, data, API_URL);
} else {
// FIXME: Supprimer data quand on fera appel à l'API Flask
const data = "data/data-v7.json";
app.csvToJson(fileUploaded, data, API_URL);
} |
Partager