fix default file on server, change file to files in lots of places
This commit is contained in:
parent
e6d94a0db8
commit
6e12ed6524
4 changed files with 10 additions and 25 deletions
|
@ -12,7 +12,7 @@ export function getProject(id) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ActionTypes.SET_PROJECT,
|
type: ActionTypes.SET_PROJECT,
|
||||||
project: response.data,
|
project: response.data,
|
||||||
file: response.data.file
|
files: response.data.files
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(response => dispatch({
|
.catch(response => dispatch({
|
||||||
|
@ -54,10 +54,7 @@ export function saveProject() {
|
||||||
type: ActionTypes.NEW_PROJECT,
|
type: ActionTypes.NEW_PROJECT,
|
||||||
name: response.data.name,
|
name: response.data.name,
|
||||||
id: response.data.id,
|
id: response.data.id,
|
||||||
file: {
|
files: response.data.files
|
||||||
name: response.data.file.name,
|
|
||||||
content: response.data.file.content
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(response => dispatch({
|
.catch(response => dispatch({
|
||||||
|
@ -78,10 +75,7 @@ export function createProject() {
|
||||||
type: ActionTypes.NEW_PROJECT,
|
type: ActionTypes.NEW_PROJECT,
|
||||||
name: response.data.name,
|
name: response.data.name,
|
||||||
id: response.data.id,
|
id: response.data.id,
|
||||||
file: {
|
files: response.data.files
|
||||||
name: response.data.file.name,
|
|
||||||
content: response.data.file.content
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(response => dispatch({
|
.catch(response => dispatch({
|
||||||
|
|
|
@ -45,9 +45,9 @@ const files = (state = initialState, action) => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
case ActionTypes.NEW_PROJECT:
|
case ActionTypes.NEW_PROJECT:
|
||||||
return { ...action.files };
|
return [...action.files];
|
||||||
case ActionTypes.SET_PROJECT:
|
case ActionTypes.SET_PROJECT:
|
||||||
return { ...action.files };
|
return [...action.files];
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,7 @@ export function createProject(req, res) {
|
||||||
return res.json({
|
return res.json({
|
||||||
id: newProject._id, // eslint-disable-line no-underscore-dangle
|
id: newProject._id, // eslint-disable-line no-underscore-dangle
|
||||||
name: newProject.name,
|
name: newProject.name,
|
||||||
file: {
|
files: newProject.files
|
||||||
name: newProject.file.name,
|
|
||||||
content: newProject.file.content
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -30,10 +27,7 @@ export function updateProject(req, res) {
|
||||||
return res.json({
|
return res.json({
|
||||||
id: updatedProject._id, // eslint-disable-line no-underscore-dangle
|
id: updatedProject._id, // eslint-disable-line no-underscore-dangle
|
||||||
name: updatedProject.name,
|
name: updatedProject.name,
|
||||||
file: {
|
file: updatedProject.files
|
||||||
name: updatedProject.file.name,
|
|
||||||
content: updatedProject.file.content
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,10 +41,7 @@ export function getProject(req, res) {
|
||||||
return res.json({
|
return res.json({
|
||||||
id: project._id, // eslint-disable-line no-underscore-dangle
|
id: project._id, // eslint-disable-line no-underscore-dangle
|
||||||
name: project.name,
|
name: project.name,
|
||||||
file: {
|
files: project.files
|
||||||
name: project.file.name,
|
|
||||||
content: project.file.content
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ import mongoose from 'mongoose';
|
||||||
const Schema = mongoose.Schema;
|
const Schema = mongoose.Schema;
|
||||||
import shortid from 'shortid';
|
import shortid from 'shortid';
|
||||||
|
|
||||||
const defaultSketch = `setup() {
|
const defaultSketch = `function setup() {
|
||||||
createCanvas(400, 400);
|
createCanvas(400, 400);
|
||||||
}
|
}
|
||||||
draw() {
|
function draw() {
|
||||||
background(220);
|
background(220);
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue