diff options
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/app/common/views/pages/page-editor/page-editor.vue | 31 |
1 files changed, 19 insertions, 12 deletions
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); }); } }, |