diff --git a/src/module/apiError.js b/src/module/apiError.js index cca8b1f..d1d20e8 100644 --- a/src/module/apiError.js +++ b/src/module/apiError.js @@ -27,5 +27,5 @@ export default async function apiError(error, toastMessage) { await delay(1000); loading.isLoading = false; await delay(500); - $toast.default(toastMessage, {position: 'bottom'}); + $toast.default('Please upload your file.', {position: 'bottom'}); } diff --git a/src/views/Files/index.vue b/src/views/Files/index.vue index ad24be5..7b943b7 100644 --- a/src/views/Files/index.vue +++ b/src/views/Files/index.vue @@ -177,8 +177,6 @@ this.store.fetchAllFiles(); this.isLoading = false; }, - beforeUnmount() { - } } diff --git a/src/views/Upload/index.vue b/src/views/Upload/index.vue index 04ab648..7a60916 100644 --- a/src/views/Upload/index.vue +++ b/src/views/Upload/index.vue @@ -293,7 +293,6 @@ export default { }, }, mounted() { - // 要有 uploadID 才能進來 // 只監聽第一次 let unwatch = this.$watch('fileName', (newValue) => { if (newValue) { @@ -307,7 +306,7 @@ export default { ); this.isInform = true; // 初始為藍字提示 this.showEdit = true; - this.filesStore.getUploadDetail(); + if(this.uploadId) this.filesStore.getUploadDetail(); unwatch(); this.isLoading = false; }, @@ -315,7 +314,16 @@ export default { // 離開頁面要刪 uploadID this.uploadId = null; this.uploadFileName = null; - } + }, + beforeRouteEnter(to, from, next){ + // 要有 uploadID 才能進來 + next(vm => { + if(vm.uploadId == null) { + vm.$router.push({name: 'Files', replace: true}); + vm.$toast.default('Please upload your file.', {position: 'bottom'}); + return + } + }) + }, } -// beforeRouteUpdate(){}