Skip to content

Commit 38badfe

Browse files
MatteoDiterrachelk585atvanek
committed
manage project fully implemented
Co-authored-by: rachelk585 <[email protected]> Co-authored-by: Adam Vanek <[email protected]>
1 parent f0cfe17 commit 38badfe

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

app/src/components/right/OpenProjects.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function ProjectsDialog(props: ProjectDialogProps) {
3636
(project: any) => project.name === value
3737
)[0];
3838
// dispatch({ type: 'OPEN PROJECT', payload: selectedProject });
39+
console.log(selectedProject);
3940
dispatch(openProject(selectedProject))
4041
onClose();
4142
};

app/src/helperFunctions/projectGetSaveDel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const saveProject = (
3333
): Promise<Object> => {
3434
const body = JSON.stringify({
3535
name,
36-
project: workspace,
36+
project: { ...workspace, name },
3737
userId: window.localStorage.getItem('ssid'),
3838
username: window.localStorage.getItem('username'),
3939
comments: []

app/src/redux/reducers/slice/appStateSlice.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -774,10 +774,7 @@ const appStateSlice = createSlice({
774774
},
775775
updateProjectName: (state, action) => {
776776
const projectName = action.payload;
777-
return {
778-
...state,
779-
name: projectName
780-
};
777+
state.name = projectName;
781778
},
782779
deleteElement: (state, action) => {
783780
let name: string = '';
@@ -867,12 +864,14 @@ const appStateSlice = createSlice({
867864
componentId: 1,
868865
childId: null
869866
};
870-
convertToJSX(action.payload.HTMLTypes);
867+
// convertToJSX(action.payload.HTMLTypes);
871868
state.canvasFocus = canvasFocus;
872869
},
873-
openProject: (state, action) => {
874-
convertToJSX(action.payload.HTMLTypes);
875-
state = action.payload;
870+
openProject: ( state, action) => {
871+
// convertToJSX(action.payload.HTMLTypes);
872+
873+
return action.payload
874+
876875
},
877876
addElement: (state, action) => {
878877
const HTMLTypes = [...state.HTMLTypes];

server/controllers/projectController.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ const projectController: ProjectController = {
88
// saveProject saves current workspace to database
99
saveProject: (req, res, next) => {
1010
// pull project name and project itself from body
11-
console.log('req body', req.body)
1211
const { name, project, userId, username, comments } = req.body;
1312
// create createdBy field for the document
1413
const createdAt = Date.now();
1514
// pull ssid from cookies for user id
1615
Projects.findOneAndUpdate(
1716
// looks in projects collection for project by user and name
18-
{ name, userId, username },
17+
{ name, userId, username},
1918
// update or insert the project
2019
{ project, createdAt, comments },
2120
// Options:

0 commit comments

Comments
 (0)