Categories
Mastering Development

Remove server error on console using axios

I just want to catch and alert the error without having this:

     client.post('/users',{
       username: un,
       password: pw
    }).then(response => {
        window.location.reload();
        alert("User successfully Added!")
    }, error => {
       alert(error.response.data.eror)
    })

That’s my code above. Hopefully someone can help me.

Leave a Reply

Your email address will not be published. Required fields are marked *