2016-06-22 21:58:23 +02:00
|
|
|
import * as ActionTypes from '../../../constants';
|
2016-06-16 22:07:38 +02:00
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
name: "Hello p5.js"
|
|
|
|
}
|
|
|
|
|
|
|
|
const project = (state = initialState, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case ActionTypes.SET_PROJECT_NAME:
|
|
|
|
return {
|
|
|
|
name: action.name
|
|
|
|
}
|
2016-06-17 20:11:52 +02:00
|
|
|
case ActionTypes.NEW_PROJECT:
|
|
|
|
return {
|
2016-06-17 22:40:13 +02:00
|
|
|
id: action.id,
|
2016-06-17 20:11:52 +02:00
|
|
|
name: action.name
|
|
|
|
}
|
2016-06-20 19:29:32 +02:00
|
|
|
case ActionTypes.SET_PROJECT:
|
|
|
|
return {
|
|
|
|
id: action.project.id,
|
|
|
|
name: action.project.name,
|
|
|
|
file: {
|
|
|
|
name: action.project.file.name,
|
|
|
|
content: action.project.file.content
|
|
|
|
}
|
|
|
|
}
|
2016-06-16 22:07:38 +02:00
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default project;
|