Fixed editing

This commit is contained in:
Jori Lallo
2016-06-26 11:38:16 -07:00
parent 0026b092d2
commit c61a2ff64f

View File

@@ -1,4 +1,4 @@
import { observable, action, computed, autorun } from 'mobx'; import { observable, action, computed, autorun, toJS } from 'mobx';
import { client } from 'utils/ApiClient'; import { client } from 'utils/ApiClient';
import localforage from 'localforage'; import localforage from 'localforage';
import { browserHistory } from 'react-router'; import { browserHistory } from 'react-router';
@@ -37,12 +37,12 @@ const documentEditStore = new class DocumentEditStore {
const data = await client.post('/documents.info', { const data = await client.post('/documents.info', {
id: this.documentId, id: this.documentId,
}) })
if (this.newDocument) { if (this.newChildDocument) {
this.parentDocument = data.data;
} else {
const { title, text } = data.data; const { title, text } = data.data;
this.title = title; this.title = title;
this.text = text; this.text = text;
} else {
this.parentDocument = data.data;
} }
} catch (e) { } catch (e) {
console.error("Something went wrong"); console.error("Something went wrong");