Answering questions using buttons works
This commit is contained in:
@ -7,6 +7,7 @@ import { getMouse } from './utils';
|
||||
// fetchHikes(dashedName?: String) => Action
|
||||
// used with fetchHikesSaga
|
||||
export const fetchHikes = createAction(types.fetchHikes);
|
||||
|
||||
// fetchHikesCompleted(hikes: Object) => Action
|
||||
// hikes is a normalized response from server
|
||||
// called within fetchHikesSaga
|
||||
@ -14,6 +15,7 @@ export const fetchHikesCompleted = createAction(
|
||||
types.fetchHikesCompleted,
|
||||
(hikes, currentHike) => ({ hikes, currentHike })
|
||||
);
|
||||
|
||||
export const resetHike = createAction(types.resetHike);
|
||||
|
||||
export const toggleQuestionView = createAction(types.toggleQuestionView);
|
||||
|
@ -118,6 +118,8 @@ function handleAnswer(getState, dispatch, next, action) {
|
||||
type: 'error',
|
||||
error
|
||||
}))
|
||||
// end with action so we know it is ok to transition
|
||||
.doOnCompleted(() => dispatch({ type: types.transitionHike }))
|
||||
.doOnNext(dispatch);
|
||||
}
|
||||
|
||||
@ -129,7 +131,7 @@ export default () => ({ getState, dispatch }) => next => {
|
||||
|
||||
// let goToNextQuestion hit reducers first
|
||||
const result = next(action);
|
||||
if (action.type === types.goToNextHike) {
|
||||
if (action.type === types.transitionHike) {
|
||||
const { hikesApp: { currentHike } } = getState();
|
||||
// if no next hike currentHike will equal '' which is falsy
|
||||
if (currentHike) {
|
||||
|
@ -15,6 +15,7 @@ const types = [
|
||||
|
||||
'primeNextQuestion',
|
||||
'goToNextQuestion',
|
||||
'transitionHike',
|
||||
|
||||
'hikeCompleted',
|
||||
'goToNextHike'
|
||||
|
Reference in New Issue
Block a user