2017-10-19 117 views
0

在我Vue2的應用程序,我執行POST請求與愛可信:在Vue2回調後Axios公司要求工作不正常

window.axios.post(`/clients/${this.getClientId}/connection`, { 
        clientType: newClientType, 
        url: this.client.url, 
        username: this.client.username, 
        password: this.client.password 
       }).then((success)=>{ 

       console.log(success); 

       },(error)=>{ 

       console.log(error); 

       }) 

如果這得到了400或409(任何錯誤響應)響應控制檯。我得到的日誌只是'假',而我通常會得到正確的迴應,不明白爲什麼這個迴應是不同的?

回答

1

試試這個,它是從docs

window.axios.post(`/clients/${this.getClientId}/connection`, { 
        clientType: newClientType, 
        url: this.client.url, 
        username: this.client.username, 
        password: this.client.password 
       }).then((success)=>{ 

       console.log(success); 

       }.catch(function (error) { 
        console.log(error); 
       }); 
+0

想這現在仍然在響應 – Ms123Robot

+0

改變你可以發表你的請求/響應語法? –