UNPKG

719 BJavaScriptView Raw
1import { createStateValidationError } from '../errors';
2export default function validate(config) {
3 return (state, action) => {
4 switch (action.type) {
5 case 'answer':
6 case 'extraLifeAccepted':
7 case 'extraLifeRefused':
8 {
9 if (state.nextContent.ref !== action.payload.content.ref || state.nextContent.type !== action.payload.content.type) {
10 throw createStateValidationError(`The content of the progression state does not match the ${action.type} action: state.nextContent: ${JSON.stringify(state.nextContent)} | action.payload.content: ${JSON.stringify(action.payload.content)}`);
11 }
12
13 break;
14 }
15 }
16 };
17}
18//# sourceMappingURL=validate.js.map
\No newline at end of file