scinote-web/app/javascript/packs/shared/reducers/TeamReducers.js
2017-08-09 12:46:04 +02:00

16 lines
492 B
JavaScript

import { SET_CURRENT_TEAM, GET_LIST_OF_TEAMS } from "../actions/types";
const initialState = { name: "", id: 0, current_team: true };
export const setCurrentTeam = (state = initialState, action) => {
if (action.type === SET_CURRENT_TEAM) {
return Object.assign({}, state, action.user);
}
return state;
};
export const getListOfTeams = (state = [], action) => {
if (action.type === GET_LIST_OF_TEAMS) {
return Object.assign({}, state, action.payload);
}
return state;
};