Default title for documents

This commit is contained in:
Jori Lallo
2016-09-22 00:00:28 -07:00
parent d2acc014e6
commit 7b7988b7d5

View File

@@ -65,7 +65,7 @@ class DocumentEditStore {
const data = await client.post('/documents.create', {
parentDocument: this.parentDocument && this.parentDocument.id,
collection: this.collectionId || this.parentDocument.collection.id,
title: this.title,
title: this.title || 'Untitled document',
text: this.text,
}, { cache: true });
const { url } = data.data;
@@ -73,7 +73,7 @@ class DocumentEditStore {
this.hasPendingChanges = false;
browserHistory.push(url);
} catch (e) {
console.error("Something went wrong");
console.error('Something went wrong');
}
this.isSaving = false;
}
@@ -86,7 +86,7 @@ class DocumentEditStore {
try {
const data = await client.post('/documents.update', {
id: this.documentId,
title: this.title,
title: this.title || 'Untitled document',
text: this.text,
}, { cache: true });
const { url } = data.data;
@@ -94,7 +94,7 @@ class DocumentEditStore {
this.hasPendingChanges = false;
browserHistory.push(url);
} catch (e) {
console.error("Something went wrong");
console.error('Something went wrong');
}
this.isSaving = false;
}
@@ -149,5 +149,5 @@ class DocumentEditStore {
export default DocumentEditStore;
export {
DOCUMENT_EDIT_SETTINGS
DOCUMENT_EDIT_SETTINGS,
};