parent
66fb96acba
commit
11051d85e6
|
@ -7,9 +7,31 @@ import axios from "axios";
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
// ...
|
// ...3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const URL = "http://100.101.64.38:3000/api/hello";
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
const [data, setData] = useState<any>({ 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[] = [
|
const columns: GridColDef[] = [
|
||||||
{
|
{
|
||||||
field: 'Vorname',
|
field: '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<any>({ 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 = [
|
const rows = [
|
||||||
{ id: "1", Vorname:{data}, Nachname: "test", Anstelldatum: "test", Geburtstag: "test" }
|
{ id: "1", Vorname:data.message, Nachname: "test", Anstelldatum: "test", Geburtstag: "test" }
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -72,7 +73,7 @@ export default function Page() {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography sx={{ fontSize: 50, fontWeight: "bold", color: "white" }}>
|
<Typography sx={{ fontSize: 50, fontWeight: "bold", color: "white" }}>
|
||||||
Welcome to the Admin panel
|
Welcome to the Admin panel bv g
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
|
|
|
@ -8,5 +8,5 @@ export default function handler(
|
||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<ResponseData>
|
res: NextApiResponse<ResponseData>
|
||||||
) {
|
) {
|
||||||
res.status(200).send({ message: 'test' })
|
res.status(200).send({ message: 'Ingrid' })
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue