에서 작동하지 않습니다REDUX-사가 내가 아래와 같이 REDUX-사가이 처음
export function* loadApplianceSaga() {
try {
let {request, success, error} = yield take(ActionTypes.APPLIANCE.LOAD);
request.url = yield select(getResourceLink, request.resource);
const response = yield call(makeRequest, request);
if (!response.error) {
yield put({type: success, payload: response.body});
} else {
yield put({type: error, payload: response});
}
} catch (e) {
yield put({type: ActionTypes.REQUEST.CALL_ERROR, error: e});
}
}
export function* watchLoadAppliance() {
while (true) {
yield* takeEvery(ActionTypes.APPLIANCE.LOAD, loadApplianceSaga);
}
}
및 루트 사가 :
export default function* rootSaga() {
yield [
fork(watchLoadAppliance)
]
}
나는 문제에 직면하고있어 그 loadApplianceSaga
아무튼 처음에는 일하지 않습니다. 로그 한 후 처음으로 ActionTypes.APPLIANCE.LOAD
액션을 전달한 것으로 보았으므로 아무 작업도 수행되지 않습니다. 그러나 두 번째로 나는 성공한 행동이나 파견 된 실패한 행동을 볼 수 있습니다.
아무도 저에게 무엇이 잘못되었는지 말할 수 있습니까? 미리 감사드립니다!
업데이트 작업을는 :
export const loadAppliances =() => {
return {
type: ActionTypes.APPLIANCE.LOAD,
request: {
resource: Resources.Appliances,
param: {
page: 0,
size: 5,
sort: 'name,desc'
},
header: {
Accept: 'application/json'
}
},
success: ActionTypes.APPLIANCE.LOAD_SUCCESS,
error: ActionTypes.APPLIANCE.LOAD_ERROR
}
};
조치에 {요청, 성공, 오류}가 포함되어 있습니까? –
예, 작업에 모두 포함됩니다. –
조치를 추가했습니다. @Utro –