Rendering blogpost items
Some checks failed
Anatid Blog CI Workflow / test (./backend) (push) Successful in 29s
Anatid Blog CI Workflow / test (./frontend) (push) Successful in 30s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Successful in 50s
Anatid Blog CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/anatid-blog-frontend, ./frontend) (push) Failing after 42s
Anatid Blog CI Workflow / deploy (push) Has been skipped

This commit is contained in:
Phill Pover 2025-03-31 17:49:48 +01:00
parent 861cec3a3a
commit 0d1352d812

View File

@ -7,9 +7,17 @@ function App() {
const [message, setMessage] = useState('');
useEffect(() => {
axios.get('https://api.anatid.net/')
axios.get('https://api.anatid.net/blogposts')
.then(response => {
setMessage(response.data);
const blogpostItems = response.data.map(blogpost =>
<li
key={blogpost.id}
>
{blogpost.title}
</li>
)
setMessage(blogpostItems);
})
.catch(error => {
console.error('There was an error fetching the data.', error);
@ -21,7 +29,7 @@ function App() {
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>React is working</h2>
<p>{message}</p>
<ul>{message}</ul>
</header>
</div>
);