MCPcopy Create free account
hub / github.com/Bitbox-Connect/Bitbox / fetchProjects

Function fetchProjects

client/src/component/Projects.jsx:16–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 useEffect(() => {
15 // Fetch the data from the API when the component mounts
16 const fetchProjects = async () => {
17 try {
18 const response = await axios.get(`${VITE_SERVER_PORT}/api/showcaseProjects/all-projects`);
19 setProjects(response.data); // Store the fetched projects in state
20 setLoading(false); // Set loading to false after data is fetched
21 } catch (err) {
22 setError('Error fetching projects');
23 setLoading(false); // Set loading to false if an error occurs
24 }
25 };
26
27 fetchProjects(); // Call the function to fetch data
28 }, []); // Empty dependency array means this effect runs once on mount

Callers 1

ProjectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected