fix bugs with saving/fetching projects
This commit is contained in:
parent
21a2b25add
commit
aa0637c256
6 changed files with 19 additions and 9 deletions
|
@ -48,6 +48,7 @@ I'm new to using ESLint, but I decided on a configuration based on some popular
|
|||
|
||||
##Dump of links I'm saving for reference
|
||||
|
||||
* https://github.com/brigade/scss-lint
|
||||
* https://github.com/petehunt/react-howto
|
||||
* https://github.com/jsbin/jsbin (especially look at the console)
|
||||
* Need to figure out how to solve the XSS issue, https://github.com/jsbin/jsbin/wiki/Best-practices-for-building-your-own-live-paste-bin
|
||||
|
|
|
@ -11,7 +11,8 @@ export function getProject(id) {
|
|||
browserHistory.push(`/projects/${id}`);
|
||||
dispatch({
|
||||
type: ActionTypes.SET_PROJECT,
|
||||
project: response.data
|
||||
project: response.data,
|
||||
file: response.data.file
|
||||
});
|
||||
})
|
||||
.catch(response => dispatch({
|
||||
|
|
|
@ -21,7 +21,12 @@ const file = (state = initialState, action) => {
|
|||
case ActionTypes.NEW_PROJECT:
|
||||
return {
|
||||
name: action.file.name,
|
||||
content: action.file.conent
|
||||
content: action.file.content
|
||||
};
|
||||
case ActionTypes.SET_PROJECT:
|
||||
return {
|
||||
name: action.file.name,
|
||||
content: action.file.content
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
|
|
@ -18,11 +18,7 @@ const project = (state = initialState, action) => {
|
|||
case ActionTypes.SET_PROJECT:
|
||||
return {
|
||||
id: action.project.id,
|
||||
name: action.project.name,
|
||||
file: {
|
||||
name: action.project.file.name,
|
||||
content: action.project.file.content
|
||||
}
|
||||
name: action.project.name
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
|
|
@ -49,7 +49,7 @@ export function getProject(req, res) {
|
|||
name: project.name,
|
||||
file: {
|
||||
name: project.file.name,
|
||||
content: project.file.conent
|
||||
content: project.file.content
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,9 +2,16 @@ import mongoose from 'mongoose';
|
|||
const Schema = mongoose.Schema;
|
||||
import shortid from 'shortid';
|
||||
|
||||
const defaultSketch = `setup() {
|
||||
createCanvas(400, 400);
|
||||
}
|
||||
draw() {
|
||||
background(220);
|
||||
}`
|
||||
|
||||
const fileSchema = new Schema({
|
||||
name: { type: String, default: 'sketch.js' },
|
||||
content: { type: String }
|
||||
content: { type: String, default: defaultSketch }
|
||||
}, { timestamps: true });
|
||||
|
||||
const projectSchema = new Schema({
|
||||
|
|
Loading…
Reference in a new issue