fix: Issues #234 done.

This commit is contained in:
chiayin
2024-03-01 17:01:18 +08:00
parent 734ab15f68
commit 0d12c50a1b
2 changed files with 5 additions and 3 deletions

View File

@@ -172,8 +172,8 @@ export async function leaveConformance(next, addConformanceCreateCheckId, toPath
* @param { string } failureMsg
*/
export async function uploadFailedFirst(failureType, failureMsg, failureLoc) {
// 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'
// msg: 'not in UTF-8' | 'insufficient columns' | 'the csv file is empty' | 'the filename does not ends with .csv' | 'not a CSV file'
// type: 'encoding' | 'insufficient_columns' | 'empty' | 'name_suffix' | mime_type
let value = '';
switch (failureType) {
case 'size':
@@ -189,7 +189,8 @@ export async function uploadFailedFirst(failureType, failureMsg, failureLoc) {
value = 'Need at least one record of data.';
break;
case 'name_suffix':
value = 'File is not in [csv] format.';
case 'mime_type':
value = 'File is not in csv format.';
break;
default:
value = failureMsg;

View File

@@ -128,6 +128,7 @@ export default defineStore('filesStore', {
this.$router.push({name: 'Upload'});
Swal.close(); // 關閉進度條
} catch(error) {
console.log(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'