This commit is contained in:
2022-03-24 18:52:48 +00:00
parent e21d3b81ba
commit f653baa5d5

View File

@@ -74,6 +74,7 @@ export default {
if (!this.uploadFile) {
return;
}
this.importResult = "";
try {
let fileType = this.uploadFile.type.toLowerCase();
if (!fileType.includes("csv") && !fileType.includes("json")) {
@@ -82,7 +83,13 @@ export default {
const isCSV = fileType.includes("csv");
let dat = null;
if (isCSV) {
dat = await parseCSVFile(this.uploadFile);
let res = await parseCSVFile(this.uploadFile);
if (res.errors) {
this.importResult = JSON.stringify(res.errors);
}
if (res.data) {
dat = res.data;
}
console.log("Done parseCSVFile");
} else {
dat = await parseJSONFile(this.uploadFile);