Advertisement
Guest User

Untitled

a guest
Dec 24th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Characters} from '../../../imports/collections/characters';
  2.  
  3. function getCharsList() {
  4.     var _chars = Characters.find({}).fetch();
  5.     console.log(_chars);
  6.     return _chars;
  7. }
  8.  
  9. const initialState = {
  10.   selected: null,
  11.   chars: getCharsList()
  12. }
  13.  
  14. export default (state = initialState, action) => {
  15.  
  16.     switch (action.type) {
  17.        
  18.         case "CHAR_SELECT":
  19.             const newState = Object.assign({}, state);
  20.             newState.selected = action.name;
  21.             return newState;
  22.         case "CHAR_LIST_UPDATE":
  23.             const newState = Object.assign({}, state);
  24.             newState.chars = getCharsList();
  25.             return newState;
  26.         default:
  27.             return state;
  28.     }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement