3
這是我第一次使用axios和我遇到了一個錯誤。反應:Axios網絡錯誤
axios.get(
`http://someurl.com/page1?param1=1¶m2=${param2_id}`
)
.then(function(response) {
alert();
})
.catch(function(error) {
console.log(error);
});
有了正確的URL和參數,當我檢查網絡請求我確實是從我的服務器得到正確的答案,但是當我打開控制檯我看它沒有調用回調,而是它捕捉到一個錯誤。
Error: Network Error Stack trace: [email protected]http://localhost:3000/static/js/bundle.js:2188:15 [email protected]http://localhost:3000/static/js/bundle.js:1717:14
你可能可以通過'console.log(error.response.data)'來了解更多關於這個的知識。 –
看到這個答案,它會幫助你知道什麼錯誤是完全正確的https://stackoverflow.com/questions/44806333/unable-to-catch-and-log-the-error-response-from-an-axios-request/44806462#44806462 –
@FaustoNA error.response is undefined – Mirakurun