title: vuejs catch error and display error message based on field that has error
body: <p>I am trying to display error messages </p>
  
  <p>this works:  </p>
  
  <pre><code>.catch(error =&gt; {
    swal(error.response.data.errors.username[0], "Error", "error");
  });  
  </code></pre>
  
  <p>this one doesn't display second error message even if it has error  </p>
  
  <pre><code>.catch(error =&gt; {
      if (error.response.data.errors.username[0]) {
        swal(error.response.data.errors.username[0], "Error", "error");
      } else if (error.response.data.errors.confirmpassword[0]) {
        swal(error.response.data.errors.confirmpassword[0], "Error", "error");
      }
   });
  </code></pre>