2017-10-19 2 views
0

In meiner Vue2 Anwendung Ich bin Vorformen eine POST-Anfrage mit axios:Beitrag axios Anfrage in Vue2 Rückruf funktioniert nicht richtig

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); 

       }) 

Wenn dies bekommt eine 400 oder 409 (Alle Antworten Fehler), um die Konsole Antwort. log ich bekomme ist nur "falsch", während ich normalerweise eine richtige Antwort bekommen würde, verstehe nicht, warum diese Antwort anders ist?

Antwort

1

die Sie interessieren, es ist eine Syntax aus dem 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

versucht, dies jetzt noch in der Antwort ändern – Ms123Robot

+0

können Sie Ihre Anfrage/Antwort schreiben? –