Skip to content
Snippets Groups Projects
Select Git revision
  • a1cc904ca77827a5a311b533897024b74433cc60
  • master default protected
  • 2023-ujoncdelutan
  • 2023-update
  • 1.4.7 protected
  • 1.4.6 protected
  • 1.4.5 protected
  • 1.4.4 protected
  • 1.4.3 protected
  • 1.4.2 protected
  • 1.4.1 protected
  • 1.4.0 protected
  • 1.3.19 protected
  • 1.3.18 protected
  • 1.3.17 protected
  • 1.3.16 protected
  • 1.3.15 protected
  • 1.3.14 protected
  • 1.3.13 protected
  • 1.3.12 protected
  • 1.3.10 protected
  • 1.3.11 protected
  • 1.3.9 protected
  • 1.3.8 protected
24 results

CorrectSolutionReducer.js

Blame
  • CorrectSolutionReducer.js 699 B
    import { WRITE_SOLUTION, CHECK, CLEAR_WRITE, SELECT_SOLUTION } from '../actions/types';
    
    const INITIAL_STATE = {
      accepted: false,
      corrected: false,
      note: '',
    };
    
    export default (state = INITIAL_STATE, action) => {
      switch (action.type) {
        case SELECT_SOLUTION:
          return {
            corrected: action.payload.corrected,
            accepted: action.payload.accepted,
            note: action.payload.note,
          };
        case WRITE_SOLUTION:
          return { ...state, [action.target]: action.payload };
        case CHECK:
          return {
            ...state,
            [action.target]: !state[action.target],
          };
        case CLEAR_WRITE:
          return INITIAL_STATE;
        default:
          return state;
      }
    };