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

Function fetchData

client/src/component/ReadMoreBlog.jsx:29–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 const { id } = useParams();
28 const [blogPost, setBlogPost] = useState(null);
29 const fetchData = async () => {
30 try {
31 const response = await fetch(`${VITE_SERVER_PORT}/api/blog/getById/${id}`);
32
33 const data = await response.json();
34 setBlogPost(data.blog); // Set the retrieved blog post to state
35 } catch (error) {
36 console.error('Error fetching blog post:', error);
37 }
38 };
39
40 useEffect(() => {
41 fetchData();

Callers 1

ReadMoreBlogFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected