Fix(challenges): reset challenge should update main iframe

This commit is contained in:
Berkeley Martinez
2016-08-01 20:20:40 -07:00
parent 4b0c25b837
commit a454cd1177

View File

@ -1,15 +1,22 @@
import { Observable } from 'rx';
import types from './types';
import { updateCurrentChallenge } from './actions';
import {
updateCurrentChallenge,
updateMain
} from './actions';
export default function resetChallengeSaga(actions$, getState) {
return actions$
.filter(({ type }) => type === types.resetChallenge)
.map(() => {
.flatMap(() => {
const {
challengesApp: { challenge: dashedName },
entities: { challenge: challengeMap }
} = getState();
const currentChallenge = challengeMap[dashedName];
return updateCurrentChallenge(currentChallenge);
return Observable.of(
updateCurrentChallenge(currentChallenge),
updateMain()
);
});
}