Header und dashboard bekommen Daten
This commit is contained in:
@@ -4,12 +4,13 @@ import Image from "next/image";
|
|||||||
import "bootstrap-icons/font/bootstrap-icons.css";
|
import "bootstrap-icons/font/bootstrap-icons.css";
|
||||||
|
|
||||||
function Header() {
|
function Header() {
|
||||||
|
const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
|
||||||
const [stationsname, setStationsname] = useState("Lädt..."); // Platzhalter
|
const [stationsname, setStationsname] = useState("Lädt..."); // Platzhalter
|
||||||
const [cplStatus, setCplStatus] = useState("Lädt...");
|
const [cplStatus, setCplStatus] = useState("Lädt...");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// API-Aufruf, um die Daten vom Server zu holen
|
// API-Aufruf, um die Daten vom Server zu holen
|
||||||
fetch("http://localhost:3000/api/server?last20Messages.acp", {
|
fetch(`${apiUrl}/CPL?last20Messages.acp`, {
|
||||||
mode: "cors",
|
mode: "cors",
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user