1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

only process json files

This commit is contained in:
irismarie 2021-05-20 16:31:58 +02:00
parent 293393996f
commit 9471759ef1

View file

@ -122,15 +122,15 @@ class EditICDialog extends React.Component {
selectStartParamsFile(event) {
const file = event.target.files[0];
if (file.type.match('application/json') === false) {
console.log("not a json file")
if (!file.type.match('application/json')) {
console.error("Not a json file. Will not process file '" + file.name + "'.")
return;
}
let reader = new FileReader();
reader.readAsText(file);
// TODO: error handling
reader.onload = event => {
const params = JSON.parse(reader.result);
this.setState({ startParameterSchema: params})