title: Connection refused error.- axios and reactjs
body: <p>I have made the Login page The UI and integrate the API through the Axios library and when I hit the API it shows the error </p>
  
  <pre><code>xhr.js:166 OPTIONS https://testapi.halanx.com/rest-auth/login/ net::ERR_CONNECTION_REFUSED
  </code></pre>
  
  <p>URL of App UI: <a href="https://assignment-task1.herokuapp.com/" rel="nofollow noreferrer">https://assignment-task1.herokuapp.com/</a></p>
  
  <p>URL OF code: <a href="https://github.com/rahulkhowal/Query-Related-to-Internship-Task---Web-Development" rel="nofollow noreferrer">https://github.com/rahulkhowal/Query-Related-to-Internship-Task---Web-Development</a></p>
  
  <p>This is the code of login</p>
  
  <pre><code>handleSubmit=(e)=&gt;{
       e.preventDefault()
       //console.log("Ihi")
       const Login={
         username:this.state.email || ' ',
         password: this.state.password || ''
        }
  
       console.log("Login", Login);
         axios.post('http://testapi.halanx.com/rest-auth/login/', {...Login}) 
  
        .then(res =&gt; {
          console.log(res);
          console.log(res.data); 
          axios.defaults.headers.common['Authorization'] =res.data;
          cookies.set('loggedIn', res.data, {path:'/'})
          this.props.history.push('Dashboard')
        })
  
        .catch(error =&gt;  {
           if(!error.response){
            this.errorStatus='Error:Network Error';
           }else{
            this.errorStatus=error.respose.data.message;
           }
        })
  }
  </code></pre>