From 7b7988b7d5849a10918b7cb3bf932be9852b8db6 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Thu, 22 Sep 2016 00:00:28 -0700 Subject: [PATCH] Default title for documents --- frontend/scenes/DocumentEdit/DocumentEditStore.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/scenes/DocumentEdit/DocumentEditStore.js b/frontend/scenes/DocumentEdit/DocumentEditStore.js index a9109add5..a8e14a392 100644 --- a/frontend/scenes/DocumentEdit/DocumentEditStore.js +++ b/frontend/scenes/DocumentEdit/DocumentEditStore.js @@ -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, };