diff --git a/components/DaughterTable.vue b/components/DaughterTable.vue new file mode 100644 index 0000000..6e34742 --- /dev/null +++ b/components/DaughterTable.vue @@ -0,0 +1,77 @@ + + + + + + diff --git a/components/ManageSerie.async.vue b/components/ManageSerie.async.vue index 7b4eef7..4e91f64 100644 --- a/components/ManageSerie.async.vue +++ b/components/ManageSerie.async.vue @@ -17,6 +17,12 @@ const nameRules = ref([ const daughterFile = ref(null); const nameSerie = ref(""); +const rDaughterTable = ref<{ + nameFile: string; + nameMeta: string; + area: number; + expectedArea: number}[]>([]); + /** * Add a new serie @@ -31,6 +37,7 @@ function add() { * We update table of metabolites of the serie */ async function sendFile() { + // Check if we have a file if (!daughterFile.value) { return; @@ -50,12 +57,29 @@ async function sendFile() { const formData = new FormData(); formData.append('file', daughterFile.value); - await $fetch('/api/extractFromFile', { + const result =await $fetch('/api/extractFromFile', { method: 'POST', body: formData, }); + + console.log(result); + + if (typeof result === 'number' || result.length === 0) { + console.log("error"); + + return; + } + + rDaughterTable.value.push( + ...result.map((r) => ({ + nameFile: daughterFile.value.name, + nameMeta: r[0], + area: r[1], + expectedArea: 0, + }))); } +