title: Axios catch error from Response JSON is undefined
body: <p>i am returning a custom response from my php and i dont know how can i use those response for my page. Im trying to use console.log to see the status and msg but no luck.</p>
  
  <pre><code>if ($message-&gt;send()){
      return response()-&gt;json([
        'status' =&gt; 'success',
           'msg' =&gt; 'Message send =)'
     ],201);
  }else{
      return response()-&gt;json([
        'status' =&gt; 'error',
           'msg' =&gt; 'Message did not send =('
     ],422);
  }
  </code></pre>
  
  <p>and in my script</p>
  
  <pre><code>axios.post('url',params)
  .then(function(){
        console.log('send');
  })
  .catch(function(error){
      if (error.response){
          console.log(error.response.data.msg);
      }else if(error.request){
          console.log(error.response.data.msg)
      }else{
          console.log(error.response.data.msg);
      }
  });
  </code></pre>
  
  <p>I want to get the <strong>status</strong> and the <strong>msg</strong>
  but the console.log(error.response.data.msg) is <strong>undefined</strong>.
  Am i doing a wrong return or a wrong console.log() ?</p>
  
  <p>appreciate the help.</p>
  
  <p><strong>I fixed it!</strong>
  i replace the function(error) to function(response).
  just like this</p>
  
  <pre><code>.then(function(response){
        console.log('response.data.msg');
        console.log('response.data.status');
  })
  .catch(function(response){
        console.log('response.data.msg');
        console.log('response.data.status');
  });
  </code></pre>