Skip to content

Commit

Permalink
[change] 作品投稿のエラーハンドリングの修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Simo-C3 committed Nov 12, 2022
1 parent eeabd17 commit 115aa5f
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions components/works/WorksForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,21 @@ export default class WorksForm extends Vue {
}
}
submitSuccessProcess() {
workPostStore.initAssetsViewInfo()
tagSelectorStore.initSelectedTags()
workPostStore.initThumbnailViewInfo()
workPostStore.initIsBlockUnload()
this.$router.push('/')
}
submitErrorProcess(error: Error) {
console.error(error)
alert(
'作品投稿に失敗しました。もう一度試すか、それでもダメな場合は管理者に報告してください。'
)
}
clickSubmit(visibility: string) {
this.workData.tags_id.splice(0)
this.getSelectedTags.map((tag) => {
Expand All @@ -177,23 +192,29 @@ export default class WorksForm extends Vue {
`/works?post_discord=${this.shareDiscord}`,
true,
this.workData
).then((result) => {
this.$router.push('/')
})
)
.then((result) => {
this.submitSuccessProcess()
})
.catch((error) => {
this.submitErrorProcess(error)
return
})
} else {
AxiosClient.client(
'PUT',
`/works/${this.$route.params.id}`,
true,
this.workData
).then((result) => {
this.$router.push('/')
})
)
.then((result) => {
this.submitSuccessProcess()
})
.catch((error) => {
this.submitErrorProcess(error)
return
})
}
workPostStore.initAssetsViewInfo()
tagSelectorStore.initSelectedTags()
workPostStore.initThumbnailViewInfo()
workPostStore.initIsBlockUnload()
} catch (error) {
console.error(error)
}
Expand Down

0 comments on commit 115aa5f

Please sign in to comment.