diff --git a/src/util/FileUploader.js b/src/util/FileUploader.js index c0ca96b..90050ec 100644 --- a/src/util/FileUploader.js +++ b/src/util/FileUploader.js @@ -24,8 +24,11 @@ export class FileUploader extends React.Component { const onUpload = (e) => { const file = e.target.files[0]; const reader = new FileReader(); - reader.onload = (e) => { - const jsonString = e.target.result; + reader.onload = () => { + const jsonString = reader.result; + if (typeof jsonString !== "string") { + throw new Error("Unexpected: jsonString is not string"); + } const json = JSON.parse(jsonString); this.props.onUpload(json); };