diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 820d4da..ceaafb0 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,22 +1,17 @@ -// src/App.jsx import { useEffect, useState } from 'react'; import './App.css'; import SectionGrid from './components/SectionGrid'; import AddAppModal from './components/AddAppModal'; import Clock from './components/Clock'; - +import { fetchSections } from './services/api'; // ✅ שימוש בפונקציה הנכונה function App() { const [sections, setSections] = useState([]); - const fetchSections = () => { - fetch('/api/apps') - .then(res => res.json()) - .then(data => setSections(data.sections || [])); - }; - useEffect(() => { - fetchSections(); + fetchSections() + .then(data => setSections(data.sections || [])) + .catch(err => console.error('Failed to fetch sections:', err)); }, []); return ( @@ -34,4 +29,4 @@ function App() { ); } -export default App; \ No newline at end of file +export default App;