diff --git a/frontend/src/calendar.jsx b/frontend/src/calendar.jsx index 3cae87a..a009321 100644 --- a/frontend/src/calendar.jsx +++ b/frontend/src/calendar.jsx @@ -88,9 +88,7 @@ export default function CalendarWidget() { const [today] = useState(new Date()); const [cur, setCur] = useState({ y: today.getFullYear(), m: today.getMonth() }); const [events, setEvents] = useState([]); - // Feeds immer frisch aus localStorage lesen - const getFeeds = () => { try { return JSON.parse(localStorage.getItem('dd_cal_feeds') || '[]'); } catch { return []; } }; - const [feedCount, setFeedCount] = useState(0); // trigger re-render + const [feeds, setFeeds] = useState([]); const [loading, setLoading] = useState(false); const [selected, setSelected] = useState(new Date()); // default: heute @@ -123,7 +121,7 @@ export default function CalendarWidget() { setLoading(false); }; - const refresh = () => { const f = getFeeds(); if (f.length > 0) loadFeeds(f); setFeedCount(f.length); }; + const refresh = () => { api('/calendar/feeds').then(f=>{ setFeeds(f); loadFeeds(f); }).catch(()=>{}); }; useEffect(() => { if (isOpen) refresh(); }, [isOpen]); // Nächster oder aktueller Termin (für zugeklappte Ansicht) @@ -162,7 +160,7 @@ export default function CalendarWidget() { - {isOpen && getFeeds().length > 0 && ( + {isOpen && feeds.length > 0 && (