Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Characters} from '../../../imports/collections/characters';
- function getCharsList() {
- var _chars = Characters.find({}).fetch();
- console.log(_chars);
- return _chars;
- }
- const initialState = {
- selected: null,
- chars: getCharsList()
- }
- export default (state = initialState, action) => {
- switch (action.type) {
- case "CHAR_SELECT":
- const newState = Object.assign({}, state);
- newState.selected = action.name;
- return newState;
- case "CHAR_LIST_UPDATE":
- const newState = Object.assign({}, state);
- newState.chars = getCharsList();
- return newState;
- default:
- return state;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement