import { useEffect, useState } from "react"; import { authFetch } from "../../auth/AuthProvider.js"; function Secret() { const [message, setMessage] = useState(""); useEffect(() => { authFetch("/api/protected") .then((response) => { if (response.status === 401) { setMessage("Sorry, du bist nicht angemeldet"); return null; } return response.json(); }) .then((response) => { if (response && response.message) { setMessage(response.message); } }); }, []); return