This commit is contained in:
@@ -75,7 +75,6 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
console.log("Upload file is:", this.uploadFile);
|
|
||||||
let fileType = this.uploadFile.type.toLowerCase();
|
let fileType = this.uploadFile.type.toLowerCase();
|
||||||
if (!fileType.includes("csv") && !fileType.includes("json")) {
|
if (!fileType.includes("csv") && !fileType.includes("json")) {
|
||||||
throw new Error("Not supported file type, must be .csv or .json");
|
throw new Error("Not supported file type, must be .csv or .json");
|
||||||
@@ -209,24 +208,15 @@ async function populateSelectionLists(vm) {
|
|||||||
// Parse csv and return results as JSON, handle errors if any
|
// Parse csv and return results as JSON, handle errors if any
|
||||||
//
|
//
|
||||||
async function parseCSVFile(file) {
|
async function parseCSVFile(file) {
|
||||||
Papa.parsePromise = function(file) {
|
return new Promise(function(complete, error) {
|
||||||
return new Promise(function(complete, error) {
|
Papa.parse(file, {
|
||||||
Papa.parse(file, {
|
header: true,
|
||||||
header: true,
|
dynamicTyping: true,
|
||||||
dynamicTyping: true,
|
worker: true,
|
||||||
worker: true,
|
complete,
|
||||||
complete,
|
error
|
||||||
error
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
let results;
|
|
||||||
await Papa.parsePromise(file).then(function(parsedData) {
|
|
||||||
results = parsedData;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user