Fix(challenges): reset challenge should update main iframe
This commit is contained in:
@ -1,15 +1,22 @@
|
|||||||
|
import { Observable } from 'rx';
|
||||||
import types from './types';
|
import types from './types';
|
||||||
import { updateCurrentChallenge } from './actions';
|
import {
|
||||||
|
updateCurrentChallenge,
|
||||||
|
updateMain
|
||||||
|
} from './actions';
|
||||||
|
|
||||||
export default function resetChallengeSaga(actions$, getState) {
|
export default function resetChallengeSaga(actions$, getState) {
|
||||||
return actions$
|
return actions$
|
||||||
.filter(({ type }) => type === types.resetChallenge)
|
.filter(({ type }) => type === types.resetChallenge)
|
||||||
.map(() => {
|
.flatMap(() => {
|
||||||
const {
|
const {
|
||||||
challengesApp: { challenge: dashedName },
|
challengesApp: { challenge: dashedName },
|
||||||
entities: { challenge: challengeMap }
|
entities: { challenge: challengeMap }
|
||||||
} = getState();
|
} = getState();
|
||||||
const currentChallenge = challengeMap[dashedName];
|
const currentChallenge = challengeMap[dashedName];
|
||||||
return updateCurrentChallenge(currentChallenge);
|
return Observable.of(
|
||||||
|
updateCurrentChallenge(currentChallenge),
|
||||||
|
updateMain()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user