feat: Files uploadFailedSecond error text done.
This commit is contained in:
@@ -123,16 +123,17 @@ 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'
|
||||
uploadFailedFirst(error.response.data.detail[0].type, error.response.data.detail[0].msg);
|
||||
let detail = error.response.data.detail;
|
||||
|
||||
uploadFailedFirst(detail[0].type, detail[0].msg, detail[0].loc[2]);
|
||||
} else {
|
||||
Swal.close(); // 關閉進度條
|
||||
apiError(error, 'Failed to upload the files.');
|
||||
@@ -164,7 +165,6 @@ 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(); // 關閉進度條
|
||||
@@ -172,10 +172,10 @@ 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);
|
||||
let detail = [...error.response.data.detail];
|
||||
|
||||
uploadFailedSecond(detail);
|
||||
} else {
|
||||
Swal.close(); // 關閉進度條
|
||||
apiError(error, 'Failed to upload the log files.');
|
||||
|
||||
Reference in New Issue
Block a user