인프런 커뮤니티 질문&답변
액션실행
작성
·
132
0
안녕하세요.
ADD_PROFILE_SUCCESS 라는 액션 실행 후 ADD_PATH_TO_ME 라는 액션 실행하게 코드를 짜뒀습니다. (아래 코드 참조)
근데 [그림1] 처럼 제대로 동작할 때도 있고 [그림2]처럼 ADD_PATH_TO_ME 가 실행이 안될떄가 있어서
이유를 잘 모르겠습니다. 어제부터 계속 비슷한 현상이 있는데 서버 아예 껐다 켜거나 에디터 껐다 켜면 될때도 있고
그래서 일종의 오류인건지 헷갈립니다 ..
[그림1]
[그림2]
function addProfileAPI(data){
return axios.post("/profile/add", data)
}
function* addProfile(action) {
try {
console.log("saga addProfile");
const result = yield call(addProfileAPI, action.data);
yield put({
type: ADD_PROFILE_SUCCESS,
data: result.data
});
yield put({
type: ADD_PATH_TO_ME,
data: result.data
});
} catch (err) {
console.error(err);
yield put({
type: ADD_PROFILE_FAILURE,
error: err.response.data,
});
}
}




