mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
fix adding notebook.
This commit is contained in:
@@ -105,23 +105,34 @@ export class AddNotebookDialog extends React.Component {
|
||||
};
|
||||
|
||||
addNewNotebook = async () => {
|
||||
let {topics} = this.state;
|
||||
let {toEdit} = this.props;
|
||||
if (!this.title)
|
||||
return ToastEvent.show('Title is required', 'error', 3000, () => {}, '');
|
||||
if (this.currentInputValue) {
|
||||
this.onSubmit();
|
||||
}
|
||||
setTimeout(async () => {
|
||||
let {topics} = this.state;
|
||||
let {toEdit} = this.props;
|
||||
if (!this.title)
|
||||
return ToastEvent.show(
|
||||
'Title is required',
|
||||
'error',
|
||||
3000,
|
||||
() => {},
|
||||
'',
|
||||
);
|
||||
|
||||
let id = toEdit && toEdit.id ? toEdit.id : null;
|
||||
let id = toEdit && toEdit.id ? toEdit.id : null;
|
||||
|
||||
await db.notebooks.add({
|
||||
title: this.title,
|
||||
description: this.description,
|
||||
topics,
|
||||
id: id,
|
||||
});
|
||||
await db.notebooks.add({
|
||||
title: this.title,
|
||||
description: this.description,
|
||||
topics,
|
||||
id: id,
|
||||
});
|
||||
|
||||
updateEvent({type: ACTIONS.NOTEBOOKS});
|
||||
this.close();
|
||||
ToastEvent.show('New notebook added', 'success', 3000, () => {}, '');
|
||||
updateEvent({type: ACTIONS.NOTEBOOKS});
|
||||
this.close();
|
||||
ToastEvent.show('New notebook added', 'success', 3000, () => {}, '');
|
||||
}, 200);
|
||||
};
|
||||
|
||||
onSubmit = () => {
|
||||
@@ -337,6 +348,7 @@ export class AddNotebookDialog extends React.Component {
|
||||
});
|
||||
}}
|
||||
onBlur={() => {
|
||||
this.onSubmit();
|
||||
this.setState({
|
||||
topicInputFoused: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user