This commit is contained in:
Tom Moor
2017-06-28 21:50:54 -07:00
parent dbb8e3df8e
commit 0b79706d23
2 changed files with 5 additions and 7 deletions

View File

@ -75,7 +75,7 @@ type Props = {
await this.document.save(); await this.document.save();
this.props.ui.disableEditMode(); this.props.ui.disableEditMode();
if (redirect) { if (redirect && this.document) {
this.props.history.push(this.document.url); this.props.history.push(this.document.url);
} }
}; };
@ -155,7 +155,7 @@ type Props = {
{isEditing {isEditing
? <SaveAction ? <SaveAction
onClick={this.onSave.bind(this, true)} onClick={this.onSave.bind(this, true)}
disabled={this.document.isSaving} disabled={get(this.document, 'isSaving')}
isNew={!!isNew} isNew={!!isNew}
/> />
: <a onClick={this.onClickEdit}>Edit</a>} : <a onClick={this.onClickEdit}>Edit</a>}

View File

@ -4,14 +4,12 @@ import invariant from 'invariant';
import get from 'lodash/get'; import get from 'lodash/get';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import type { Document as DocumentType } from 'types'; import Document from 'models/Document';
import DropdownMenu, { MenuItem, MoreIcon } from 'components/DropdownMenu'; import DropdownMenu, { MenuItem, MoreIcon } from 'components/DropdownMenu';
import DocumentStore from '../DocumentStore';
type Props = { type Props = {
history: Object, history: Object,
document: DocumentType, document: Document,
store: DocumentStore,
}; };
@observer class Menu extends Component { @observer class Menu extends Component {
@ -38,7 +36,7 @@ type Props = {
} }
if (confirm(msg)) { if (confirm(msg)) {
this.props.store.deleteDocument(); this.props.document.delete();
} }
}; };