diff --git a/src/pages/treff.js b/src/pages/treff.js index d0faa30..e2e5c9d 100644 --- a/src/pages/treff.js +++ b/src/pages/treff.js @@ -1,10 +1,26 @@ -import React from "react" +import React, { useEffect, useState } from "react" import Layout from "../components/layout" -export default () => ( - -

- Raumtatus OFFEN -

-
-) +export default () => { + const [opened, setOpened] = useState(false) + + useEffect(() => { + async function fetchState() { + const response = await fetch("https://status.ctdo.de/api/simple/v2") + const json = await response.json() + setOpened(json.state) + } + fetchState() + }, []) + + return ( + +

+ Raumtatus{" "} + + {opened ? "OFFEN" : "GESCHLOSSEN"} + +

+
+ ) +}