@@ -126,7 +126,7 @@ function getSynchedProject(currentState, responseProject) {
126
126
} ;
127
127
}
128
128
129
- export function saveProject ( selectedFile = null , autosave = false ) {
129
+ export function saveProject ( selectedFile = null , autosave = false , mobile = false ) {
130
130
return ( dispatch , getState ) => {
131
131
const state = getState ( ) ;
132
132
if ( state . project . isSaving ) {
@@ -185,16 +185,15 @@ export function saveProject(selectedFile = null, autosave = false) {
185
185
. then ( ( response ) => {
186
186
dispatch ( endSavingProject ( ) ) ;
187
187
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
+
188
193
if ( hasChanges ) {
189
- dispatch ( setNewProject ( synchedProject ) ) ;
190
- dispatch ( setUnsavedChanges ( false ) ) ;
191
- browserHistory . push ( `/${ response . data . user . username } /sketches/${ response . data . id } ` ) ;
192
194
dispatch ( setUnsavedChanges ( true ) ) ;
193
- } else {
194
- dispatch ( setNewProject ( synchedProject ) ) ;
195
- dispatch ( setUnsavedChanges ( false ) ) ;
196
- browserHistory . push ( `/${ response . data . user . username } /sketches/${ response . data . id } ` ) ;
197
195
}
196
+
198
197
dispatch ( projectSaveSuccess ( ) ) ;
199
198
if ( ! autosave ) {
200
199
if ( state . preferences . autosave ) {
@@ -222,9 +221,9 @@ export function saveProject(selectedFile = null, autosave = false) {
222
221
} ;
223
222
}
224
223
225
- export function autosaveProject ( ) {
224
+ export function autosaveProject ( mobile = false ) {
226
225
return ( dispatch , getState ) => {
227
- saveProject ( null , true ) ( dispatch , getState ) ;
226
+ saveProject ( null , true , mobile ) ( dispatch , getState ) ;
228
227
} ;
229
228
}
230
229
0 commit comments