stand_2026_10_08

This commit is contained in:
marco committed 2026-10-08 09:49:32 +02:00
1 parent 266f8c3b4f
commit 05f4390392
7 files changed
+149 -3

No files matched your search

@@ -0,0 +1,48 @@
"use client";
import { api_signals_excel_upload } from "@/actions/rk2/api-signals";
import { useState } from "react";
interface Props{
onLoadData?:any
}
export default function SignalExcelUpload() {
const [file, setFile] = useState<File | null>(null);
const [data, setData] = useState<any>();
const uploadExcel = async () => {
if (!file) return;
const formData = new FormData();
formData.append("file", file);
const response = await api_signals_excel_upload(formData)
if (!response.success) {
throw new Error("Upload fehlgeschlagen");
}
const result = await response.data;
setData(result)
console.log(result);
};
return (
<div>
<input
type="file"
accept=".xlsx,.xls"
onChange={(e) =>
setFile(e.target.files?.[0] ?? null)
}
/>
<button onClick={uploadExcel}>
Excel hochladen
</button>
{data && <div>{JSON.stringify(data,null,2)}</div>}
</div>
);
}