|
|
|
@ -108,6 +108,7 @@ class ImportDialog extends React.Component<PropsType> {
|
|
|
|
|
reader.onabort = () => alert('file reading was aborted');
|
|
|
|
|
reader.onerror = () => alert('file reading has failed');
|
|
|
|
|
reader.onload = () => {
|
|
|
|
|
try {
|
|
|
|
|
const fileText = reader.result as string;
|
|
|
|
|
const items = itemsCreator(fileText);
|
|
|
|
|
|
|
|
|
@ -134,6 +135,15 @@ class ImportDialog extends React.Component<PropsType> {
|
|
|
|
|
this.props.onClose();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
alert('An error has occurred, please contact developers.');
|
|
|
|
|
if (this.props.onClose) {
|
|
|
|
|
this.setState({ loading: false });
|
|
|
|
|
this.props.onClose();
|
|
|
|
|
}
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.setState({ loading: true });
|
|
|
|
|