From cd297b20e3fade789aeb7d136a4b30ede8147d9c Mon Sep 17 00:00:00 2001 From: liberty-rising Date: Sat, 20 Jan 2024 15:30:10 +0100 Subject: [PATCH] fixes --- frontend/src/pages/upload/PreviewTable.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/upload/PreviewTable.jsx b/frontend/src/pages/upload/PreviewTable.jsx index 022c743..922268e 100644 --- a/frontend/src/pages/upload/PreviewTable.jsx +++ b/frontend/src/pages/upload/PreviewTable.jsx @@ -10,6 +10,8 @@ import { } from "@mui/material"; function PreviewTable({ previewData }) { + const data = Array.isArray(previewData) ? previewData : [previewData]; + const generateTableHeaders = (data) => { if (data && data.length > 0) { return Object.keys(data[0]).map((key) => ( @@ -23,10 +25,10 @@ function PreviewTable({ previewData }) { - {generateTableHeaders(previewData)} + {generateTableHeaders(data)} - {previewData.map((row, index) => ( + {data.map((row, index) => ( {Object.values(row).map((value, idx) => ( {value}