diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index 6e71882..c73a157 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -7,10 +7,32 @@ import axios from "axios"; import { useEffect, useState } from "react"; -// ... +// ...3 -const columns: GridColDef[] = [ + + + +const URL = "http://100.101.64.38:3000/api/hello"; + +export default function Page() { + const [data, setData] = useState({ message: "" }); + + useEffect(() => { + async function getData() { + try { + const response = await fetch(URL); + const jsonData = await response.json(); + setData(jsonData); + } catch (error) { + console.error("Error fetching data:", error); + } + } + + getData(); + }, []); + + const columns: GridColDef[] = [ { field: 'Vorname', headerName: 'Vorname', @@ -35,29 +57,8 @@ const columns: GridColDef[] = [ }, ]; - -const URL = "http://100.101.64.38:3000/api/hello"; - -export default function Page() { - const [data, setData] = useState({ mes: "" }); - - useEffect(() => { - async function getData() { - try { - const response = await fetch(URL); - const jsonData = await response.json(); - setData(jsonData); - } catch (error) { - console.error("Error fetching data:", error); - } - } - - getData(); - }, []); - - const rows = [ - { id: "1", Vorname:{data}, Nachname: "test", Anstelldatum: "test", Geburtstag: "test" } + { id: "1", Vorname:data.message, Nachname: "test", Anstelldatum: "test", Geburtstag: "test" } ]; return ( @@ -72,7 +73,7 @@ export default function Page() { }} > - Welcome to the Admin panel + Welcome to the Admin panel bv g ) { - res.status(200).send({ message: 'test' }) + res.status(200).send({ message: 'Ingrid' }) }