@coorpacademy/progression-engine
Version:
17 lines (14 loc) • 428 B
Flow
// @flow
import type {Action, AnswerAction, Config} from '../types';
export default function isCorrect(config: Config): (?boolean, Action) => ?boolean {
return (state: ?boolean = true, action: Action): ?boolean => {
switch (action.type) {
case 'answer': {
const answerAction = (action: AnswerAction);
return answerAction.payload.isCorrect;
}
default:
return state;
}
};
}