2017-08-03 22:03:15 +08:00
|
|
|
import { SET_CURRENT_TEAM, GET_LIST_OF_TEAMS } from "../actions/types";
|
2017-08-02 23:27:05 +08:00
|
|
|
|
2017-08-08 21:44:28 +08:00
|
|
|
const initialState = { name: "", id: 0, current_team: true }
|
|
|
|
export const setCurrentTeam = (state = initialState, action) => {
|
2017-08-02 23:27:05 +08:00
|
|
|
if (action.type === SET_CURRENT_TEAM) {
|
2017-08-03 22:03:15 +08:00
|
|
|
return Object.assign({}, state, action.user);
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
};
|
|
|
|
|
2017-08-08 21:44:28 +08:00
|
|
|
export const getListOfTeams = (state = [initialState], action) => {
|
2017-08-03 22:03:15 +08:00
|
|
|
if (action.type === GET_LIST_OF_TEAMS) {
|
2017-08-07 19:51:22 +08:00
|
|
|
return [...state, ...action.payload]
|
2017-08-02 23:27:05 +08:00
|
|
|
}
|
|
|
|
return state;
|
|
|
|
};
|