From a9f991a715ba4603f5e63966176d486eab4b7674 Mon Sep 17 00:00:00 2001 From: chiayin Date: Wed, 17 Jan 2024 11:20:36 +0800 Subject: [PATCH] feat: Files uploadFailedFirst size > 80MB text done. --- src/module/alertModal.js | 2 +- src/stores/files.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/module/alertModal.js b/src/module/alertModal.js index 0bc895e..3a0db33 100644 --- a/src/module/alertModal.js +++ b/src/module/alertModal.js @@ -177,7 +177,7 @@ export async function uploadFailedFirst(failureType, failureMsg) { let value = ''; switch (failureType) { case 'size': - value = '檔案大小不可超過 90MB'; + value = 'File size exceeds 90MB.'; break; case 'encoding': value = 'not in UTF-8'; diff --git a/src/stores/files.js b/src/stores/files.js index c4a9508..f2782ba 100644 --- a/src/stores/files.js +++ b/src/stores/files.js @@ -123,10 +123,12 @@ export default defineStore('filesStore', { uploadloader(); // 進度條 try { const response = await axios.post(api, fromData, config); + console.log('第一階段 response:', response); this.uploadId = response.data.id; this.$router.push({name: 'Upload'}); Swal.close(); // 關閉進度條 } catch(error) { + console.log('第一階段 error:', error); if(error.response.status === 422) { // msg: 'not in UTF-8' | 'insufficient columns' | 'the csv file is empty' | 'the filename does not ends with .csv' // type: 'encoding' | 'insufficient_columns' | 'empty' | 'name_suffix' @@ -162,6 +164,7 @@ export default defineStore('filesStore', { uploadloader(); // 進度條 try { const response = await axios.post(api, data); + console.log('第二階段 response:', response); this.uploadLogId = await response.data.id; await Swal.close(); // 關閉進度條 @@ -169,6 +172,8 @@ export default defineStore('filesStore', { await uploadSuccess(); this.$router.push({name: 'Files'}); } catch(error) { + console.log('第二階段 error:', error); + if(error.response.status === 422) { uploadFailedSecond(error.response.data.detail[0].type, error.response.data.detail[0].msg); } else {