Javascript/Vue

[Vue.js] axios__WEBPACK_IMPORTED_MODULE_2___default.a.get(...).then(...).error is not a function

yemsu 2021. 6. 28. 11:03

api호출은 정상적으로 잘 되는데 자꾸 빨간 콘솔에러가 떠있어서 너무 거슬렸다.

 

axios__WEBPACK_IMPORTED_MODULE_2___default.a.get(...).then(...).error is not a function

 

구글링 해봐도 같은 케이스가 찾기 힘들어서 봤더니

.error로 써놨다.

.catch로 바꿔주니까 콘솔창 깔꿈!

      fetchList(type)
        .then(response => commit(`SET_LIST`, {data: response.data, type}))
        .error(error => console.log(error)) //.error를 .catch로 바꿔야함