p5.js-web-editor/client/modules/IDE/reducers/project.js

29 lines
562 B
JavaScript
Raw Normal View History

2016-06-22 19:58:23 +00:00
import * as ActionTypes from '../../../constants';
const initialState = {
2016-06-23 22:29:55 +00:00
name: 'Hello p5.js'
};
const project = (state = initialState, action) => {
2016-06-23 22:29:55 +00:00
switch (action.type) {
case ActionTypes.SET_PROJECT_NAME:
return {
name: action.name
};
case ActionTypes.NEW_PROJECT:
return {
id: action.id,
name: action.name
};
case ActionTypes.SET_PROJECT:
return {
id: action.project.id,
2016-06-29 16:52:16 +00:00
name: action.project.name
2016-06-23 22:29:55 +00:00
};
default:
return state;
}
};
2016-06-23 22:29:55 +00:00
export default project;