In a Vue component I am trying to store error status in a variable errorMessage

Somehow I do not get how to do it.

My method is:

```
         addSpeler(){

           const formData = new FormData();
            formData.append('name',this.name);
            formData.append('pass_code',this.pass_code);
            formData.append('game_id', this.currentGame.id);

            if(this.exists === false){
                //add
                fetch(`api/speler`, {
                    method: 'post',
                    body:formData,
                    headers:{
                        //'content-type': 'multipart/form-data',
                       // 'accept':'application/json'
                    }
                })
                .then(res => console.log(res))
                //.then(res => res.json())
                .then(data => {
                    this.name='';
                    this.code='';
                })
                .catch(err => {
                    this.errorMessage = err.res.status;
                    console.log(err);
                });

            } 
        }, 

```

The script works, I get a 201 error when the record is created.
I get a 500 error when the user cannot be created,

I cannot get the response.statusText and response.status stored in the errorMessage

Clearly I do not understand some aprts of the concept.

can anyone help me out here?