feat: Upload no uploadId need to next to files page.
This commit is contained in:
@@ -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'});
|
||||
}
|
||||
|
||||
@@ -177,8 +177,6 @@
|
||||
this.store.fetchAllFiles();
|
||||
this.isLoading = false;
|
||||
},
|
||||
beforeUnmount() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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(){}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user