@@ -126,7 +126,7 @@ function getSynchedProject(currentState, responseProject) {
126126 } ;
127127}
128128
129- export function saveProject ( selectedFile = null , autosave = false ) {
129+ export function saveProject ( selectedFile = null , autosave = false , mobile = false ) {
130130 return ( dispatch , getState ) => {
131131 const state = getState ( ) ;
132132 if ( state . project . isSaving ) {
@@ -185,16 +185,15 @@ export function saveProject(selectedFile = null, autosave = false) {
185185 . then ( ( response ) => {
186186 dispatch ( endSavingProject ( ) ) ;
187187 const { hasChanges, synchedProject } = getSynchedProject ( getState ( ) , response . data ) ;
188+
189+ dispatch ( setNewProject ( synchedProject ) ) ;
190+ dispatch ( setUnsavedChanges ( false ) ) ;
191+ browserHistory . push ( `${ mobile ? '/mobile' : '' } /${ response . data . user . username } /sketches/${ response . data . id } ` ) ;
192+
188193 if ( hasChanges ) {
189- dispatch ( setNewProject ( synchedProject ) ) ;
190- dispatch ( setUnsavedChanges ( false ) ) ;
191- browserHistory . push ( `/${ response . data . user . username } /sketches/${ response . data . id } ` ) ;
192194 dispatch ( setUnsavedChanges ( true ) ) ;
193- } else {
194- dispatch ( setNewProject ( synchedProject ) ) ;
195- dispatch ( setUnsavedChanges ( false ) ) ;
196- browserHistory . push ( `/${ response . data . user . username } /sketches/${ response . data . id } ` ) ;
197195 }
196+
198197 dispatch ( projectSaveSuccess ( ) ) ;
199198 if ( ! autosave ) {
200199 if ( state . preferences . autosave ) {
@@ -222,9 +221,9 @@ export function saveProject(selectedFile = null, autosave = false) {
222221 } ;
223222}
224223
225- export function autosaveProject ( ) {
224+ export function autosaveProject ( mobile = false ) {
226225 return ( dispatch , getState ) => {
227- saveProject ( null , true ) ( dispatch , getState ) ;
226+ saveProject ( null , true , mobile ) ( dispatch , getState ) ;
228227 } ;
229228}
230229
0 commit comments