This commit is contained in:
Cassie Tarakajian 2017-03-06 14:13:39 -05:00
parent abbeb7fc60
commit 134cc76981
2 changed files with 7 additions and 2 deletions

View File

@ -53,6 +53,7 @@ export function saveProject(autosave = false) {
axios.put(`${ROOT_URL}/projects/${state.project.id}`, formParams, { withCredentials: true }) axios.put(`${ROOT_URL}/projects/${state.project.id}`, formParams, { withCredentials: true })
.then((response) => { .then((response) => {
dispatch(setUnsavedChanges(false)); dispatch(setUnsavedChanges(false));
console.log(response.data);
dispatch(setProject(response.data)); dispatch(setProject(response.data));
dispatch({ dispatch({
type: ActionTypes.PROJECT_SAVE_SUCCESS type: ActionTypes.PROJECT_SAVE_SUCCESS
@ -180,7 +181,10 @@ export function cloneProject() {
return (dispatch, getState) => { return (dispatch, getState) => {
dispatch(setUnsavedChanges(false)); dispatch(setUnsavedChanges(false));
const state = getState(); const state = getState();
const newFiles = [...state.files]; const newFiles = state.files.map((file) => { // eslint-disable-line
return { ...file };
});
const rootFile = newFiles.find(file => file.name === 'root'); const rootFile = newFiles.find(file => file.name === 'root');
const newRootFileId = objectID().toHexString(); const newRootFileId = objectID().toHexString();
rootFile.id = newRootFileId; rootFile.id = newRootFileId;
@ -191,6 +195,7 @@ export function cloneProject() {
axios.post(`${ROOT_URL}/projects`, formParams, { withCredentials: true }) axios.post(`${ROOT_URL}/projects`, formParams, { withCredentials: true })
.then((response) => { .then((response) => {
browserHistory.push(`/${response.data.user.username}/sketches/${response.data.id}`); browserHistory.push(`/${response.data.user.username}/sketches/${response.data.id}`);
console.log(response.data);
dispatch({ dispatch({
type: ActionTypes.NEW_PROJECT, type: ActionTypes.NEW_PROJECT,
project: response.data, project: response.data,

View File

@ -114,7 +114,6 @@ class Editor extends React.Component {
if (this.props.files.length !== nextProps.files.length) { if (this.props.files.length !== nextProps.files.length) {
this.initializeDocuments(nextProps.files); this.initializeDocuments(nextProps.files);
} }
console.log(nextProps.projectSavedTime);
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
@ -162,6 +161,7 @@ class Editor extends React.Component {
} }
initializeDocuments(files) { initializeDocuments(files) {
console.log('calling initialize documents');
this._docs = {}; this._docs = {};
files.forEach((file) => { files.forEach((file) => {
if (file.name !== 'root') { if (file.name !== 'root') {