From cefd2a4c5448b730fe2ffed7b99a0e71e5788697 Mon Sep 17 00:00:00 2001 From: Oni-Men Date: Mon, 2 Sep 2019 06:02:35 +0900 Subject: ページURLが空の時currentNameを使うように (#5368) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ページURLが空の時currentNameを使う * 空の時はページURLにcurrentNameを代入するように * Update src/client/app/common/views/pages/page-editor/page-editor.vue Co-Authored-By: Acid Chicken (硫酸鶏) * update validator * Update src/client/app/common/views/pages/page-editor/page-editor.vue Co-Authored-By: Acid Chicken (硫酸鶏) * やっぱりuuidは統一 * エラー処理を追加 * some fix * ちょっとだけ翻訳の追加と改善 * リファクタリング * Revert "やっぱりuuidは統一" This reverts commit 965a860504e8b09e5561a4ab862f8bab6a95e8d5. * やっぱりuuidをわける * エラー判定をidからcodeに+リファクタリング --- .../common/views/pages/page-editor/page-editor.vue | 31 +++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/client') diff --git a/src/client/app/common/views/pages/page-editor/page-editor.vue b/src/client/app/common/views/pages/page-editor/page-editor.vue index b8db59da41..0e7417700d 100644 --- a/src/client/app/common/views/pages/page-editor/page-editor.vue +++ b/src/client/app/common/views/pages/page-editor/page-editor.vue @@ -232,6 +232,23 @@ export default Vue.extend({ eyeCatchingImageId: this.eyeCatchingImageId, }; + function onError(err) { + if (err.id == '3d81ceae-475f-4600-b2a8-2bc116157532') { + if (err.info.param == 'name') { + this.$root.dialog({ + type: 'error', + title: this.$t('title-invalid-name'), + text: this.$t('text-invalid-name') + }); + } + } else if (err.code == 'NAME_ALREADY_EXISTS') { + this.$root.dialog({ + type: 'error', + text: this.$t('name-already-exists') + }); + } + } + if (this.pageId) { options.pageId = this.pageId; this.$root.api('pages/update', options) @@ -242,12 +259,7 @@ export default Vue.extend({ text: this.$t('page-updated') }); }).catch(err => { - if(err.id == '2298a392-d4a1-44c5-9ebb-ac1aeaa5a9ab'){ - this.$root.dialog({ - type: 'error', - text: this.$t('name-already-exists') - }); - } + onError(err); }); } else { this.$root.api('pages/create', options) @@ -260,12 +272,7 @@ export default Vue.extend({ }); this.$router.push(`/i/pages/edit/${this.pageId}`); }).catch(err => { - if(err.id == '4650348e-301c-499a-83c9-6aa988c66bc1'){ - this.$root.dialog({ - type: 'error', - text: this.$t('name-already-exists') - }); - } + onError(err); }); } }, -- cgit v1.2.3-freya