Fix type error in FileUploader (#1280)
Summary: Introduced in #1277. Test Plan: Run `yarn start` and visit <http://localhost:8080/test/FileUploader/>. Conduct the test plan as specified on that page. wchargin-branch: fileuploader-target
This commit is contained in:
parent
95b8974f6a
commit
607a6d426d
|
@ -24,8 +24,11 @@ export class FileUploader extends React.Component<Props> {
|
|||
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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue