react-logo/frontend/src/reducers/project.js

31 lines
579 B
JavaScript
Raw Normal View History

2020-02-19 11:53:32 +01:00
import {
PROJECT_USER_LIST_SUCCESS,
PROJECT_USER_LIST_FAILURE
} from '../actions/project';
2020-02-19 11:53:32 +01:00
const initialState = {
items: []
};
2020-02-19 11:53:32 +01:00
export default (state = initialState, action) => {
console.log(`Action: ${JSON.stringify(action)}`);
2020-02-19 11:53:32 +01:00
switch (action.type) {
case PROJECT_USER_LIST_SUCCESS:
return {
...state,
items: action.projects
};
2020-02-19 11:53:32 +01:00
case PROJECT_USER_LIST_FAILURE:
return {
...state,
items: [],
error: action.error
};
2020-02-19 11:53:32 +01:00
}
return state;
2020-02-19 11:53:32 +01:00
};