• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

게시글 불러오기할때 에러는 없는데 then 이후로 실행이 안되서여

20.01.27 12:08 작성 조회수 186

0

에러도 없고 액션도 실행되는데 then 이후로 실행이 안되는것 같아여 

게시글을 입력한뒤에 게시글 출력되는건 잘되는데 

왜그런건지 몰겠어여 

답변 4

·

답변을 작성해보세요.

2

hwd3527님의 프로필

hwd3527

2020.01.28

async loadPosts({ commit, state }, payload) {

        if(state.hasMorePost) {

            try {

                const res = await this.$axios.get(`http://localhost:3085/posts?offset=${state.mainPosts.length}&limit=10`);

                commit('loadPosts', res.data);

            } catch (err) {

                console.error(err);

            }

        }

    },

저는 이렇게 수정해서 해결했습니다만...

똑같은 질문이 계속 올라오네요;;

0

제 코드를 받아서 해보세요. 질문자분들이 너무 많아 일일이 코드를 받아서 해결드리기 힘듭니다.

0

terecal님의 프로필

terecal

질문자

2020.01.28

바꿨는데 에러 메세지가 출력 안되여 

https://github.com/hyunsokstar/vue-nodebird-hyun/blob/master/ch2/front/store/posts.js

콘솔 메세지도 then 전까지만 출력되여

client.js?06a0:43 index fetch 실행

client.js?06a0:43 loadPosts 실행 확인 1111

client.js?06a0:43 loadPosts 실행 확인 2222

ㅈㅅ한데 한번 받아서 해봐주시면 안될까여

0

then 뒤에 catch를 붙여보세요. 에러가 뜰 것입니다.

.catch((err) => {
  console.log(err);
});