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 * @param { string } failureMsg
*/ */
export async function uploadFailedFirst(failureType, failureMsg, failureLoc) { 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' // 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' // type: 'encoding' | 'insufficient_columns' | 'empty' | 'name_suffix' | mime_type
let value = ''; let value = '';
switch (failureType) { switch (failureType) {
case 'size': case 'size':
@@ -189,7 +189,8 @@ export async function uploadFailedFirst(failureType, failureMsg, failureLoc) {
value = 'Need at least one record of data.'; value = 'Need at least one record of data.';
break; break;
case 'name_suffix': case 'name_suffix':
value = 'File is not in [csv] format.'; case 'mime_type':
value = 'File is not in csv format.';
break; break;
default: default:
value = failureMsg; value = failureMsg;

View File

@@ -128,6 +128,7 @@ export default defineStore('filesStore', {
this.$router.push({name: 'Upload'}); this.$router.push({name: 'Upload'});
Swal.close(); // 關閉進度條 Swal.close(); // 關閉進度條
} catch(error) { } catch(error) {
console.log(error);
if(error.response.status === 422) { if(error.response.status === 422) {
// msg: 'not in UTF-8' | 'insufficient columns' | 'the csv file is empty' | 'the filename does not ends with .csv' // 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' // type: 'encoding' | 'insufficient_columns' | 'empty' | 'name_suffix'