@coorpacademy/progression-engine
Version:
18 lines (15 loc) • 496 B
Flow
// @flow
import {concat} from 'lodash/fp';
import type {Action, AnswerAction, Config} from '../types';
export default function slides(config: Config): (Array<string>, Action) => Array<string> {
return (array: Array<string> = [], action: Action): Array<string> => {
switch (action.type) {
case 'answer': {
const answerAction = (action: AnswerAction);
return concat(array, [answerAction.payload.content.ref]);
}
default:
return array;
}
};
}