redux: router fixed

This commit is contained in:
muerwre 2018-11-26 15:50:36 +07:00
parent 5d2c534aa9
commit eb5b0e5d28
6 changed files with 98 additions and 39 deletions

View file

@ -16,3 +16,6 @@ export const setAddress = address => ({ type: ACTIONS.SET_ADDRESS, address });
export const startEditing = () => ({ type: ACTIONS.START_EDITING });
export const stopEditing = () => ({ type: ACTIONS.STOP_EDITING });
export const routerCancel = () => ({ type: ACTIONS.ROUTER_CANCEL });
export const routerSubmit = () => ({ type: ACTIONS.ROUTER_SUBMIT });

View file

@ -14,4 +14,7 @@ export const ACTIONS = {
START_EDITING: 'START_EDITING',
STOP_EDITING: 'STOP_EDITING',
ROUTER_CANCEL: 'ROUTER_CANCEL',
ROUTER_SUBMIT: 'ROUTER_SUBMIT',
};

View file

@ -127,6 +127,20 @@ function* setLogoSaga({ logo }) {
}
}
function* routerCancelSaga() {
yield call(editor.router.cancelDrawing);
yield put(setMode(MODES.NONE));
return true;
}
function* routerSubmitSaga() {
yield call(editor.router.submitDrawing);
yield put(setMode(MODES.NONE));
return true;
}
export function* userSaga() {
// ASYNCHRONOUS!!! :-)
@ -139,4 +153,7 @@ export function* userSaga() {
yield takeEvery(ACTIONS.USER_LOGOUT, userLogoutSaga);
yield takeEvery(ACTIONS.SET_ACTIVE_STICKER, setActiveStickerSaga);
yield takeEvery(ACTIONS.SET_LOGO, setLogoSaga);
yield takeEvery(ACTIONS.ROUTER_CANCEL, routerCancelSaga);
yield takeEvery(ACTIONS.ROUTER_SUBMIT, routerSubmitSaga);
}