mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-19 09:03:54 +00:00
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 onUpload = (e) => {
|
||||||
const file = e.target.files[0];
|
const file = e.target.files[0];
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = () => {
|
||||||
const jsonString = e.target.result;
|
const jsonString = reader.result;
|
||||||
|
if (typeof jsonString !== "string") {
|
||||||
|
throw new Error("Unexpected: jsonString is not string");
|
||||||
|
}
|
||||||
const json = JSON.parse(jsonString);
|
const json = JSON.parse(jsonString);
|
||||||
this.props.onUpload(json);
|
this.props.onUpload(json);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user