Skip to content
Snippets Groups Projects
Select Git revision
  • 2e24d7f820b3e32e98fbac7b9ae68f812058fbe5
  • 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

AddSolutionReducer.js

Blame
  • AddSolutionReducer.js 621 B
    import { WRITE_SOLUTION, WRITE_SOLUTION_FILE, GET_SOLUTIONS, CLEAR_WRITE } from '../actions/types';
    
    const INITIAL_STATE = {
      task: '',
      name: '',
      description: '',
      file: '',
      solutions: [],
    };
    
    export default (state = INITIAL_STATE, action) => {
      switch (action.type) {
        case WRITE_SOLUTION:
          return { ...state, [action.target]: action.payload };
        case WRITE_SOLUTION_FILE:
          return { ...state, [action.target]: action.payload };
        case GET_SOLUTIONS:
          return { ...state, solutions: action.payload };
        case CLEAR_WRITE:
          return INITIAL_STATE;
        default:
          return state;
      }
    };