I'm struggling to figure out how to console log an error I am getting from my django-rest framework. This is what I currently have

```
const onSubmit = (data) => {
    const user = {
        username: data.username,
        email: data.email,
        password: data.password,
        profile: {
                    city: data.city,
                    country: data.country,
        }
    };
    fetch('http://127.0.0.1:8000/api/register', {
        method: 'POST',
        headers: {
            'Content-Type':'application/json'
        },
        body: JSON.stringify(user)
        })
        .then(res => res.json())
            .then((data) => {
            })
            .catch((resp)=>{console.log(resp)})
    };

```

This is an example of an error I am getting:

```
{"username":["A user with that username already exists."]}

```

This is a `400 Error`