1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Got sync to work

This commit is contained in:
Laurent Cozic
2017-11-06 21:11:15 +00:00
parent c1cb020283
commit 26d9b57923
6 changed files with 49 additions and 43 deletions

View File

@@ -105,32 +105,8 @@ class SideMenuContentComponent extends Component {
}
async synchronize_press() {
const action = this.props.syncStarted ? 'cancel' : 'start';
if (Setting.value('sync.target') == Setting.SYNC_TARGET_ONEDRIVE && !reg.oneDriveApi().auth()) {
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
this.props.dispatch({
type: 'NAV_GO',
routeName: 'OneDriveLogin',
});
return;
}
let sync = null;
try {
sync = await reg.synchronizer(Setting.value('sync.target'))
} catch (error) {
reg.logger().info('Could not acquire synchroniser:');
reg.logger().info(error);
return;
}
if (action == 'cancel') {
sync.cancel();
} else {
reg.scheduleSync(0);
}
const actionDone = await shared.synchronize_press(this);
if (actionDone === 'auth') this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
}
folderItem(folder, selected) {