Update app to fetch correctly
This commit is contained in:
parent
fa26c24d15
commit
9f37cf6b58
@ -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;
|
||||
export default App;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user