Common pitfall: Forgetting that fetch() doesn’t throw errors for HTTP errors (like 404). You gotta check `response.ok`:
```javascript
fetch('url', { method: 'POST', ... })
.then(response => {
if (!response.ok) throw new Error('Server said no');
return response.json();
})
.then(data => console.log(data))
.catch(err => console.log('Failed:', err));
```
Small thing, but it’ll save you headaches.
```javascript
fetch('url', { method: 'POST', ... })
.then(response => {
if (!response.ok) throw new Error('Server said no');
return response.json();
})
.then(data => console.log(data))
.catch(err => console.log('Failed:', err));
```
Small thing, but it’ll save you headaches.
