1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

move sync upon login to vault controller initiated via state params.

This commit is contained in:
Kyle Spearrin
2016-09-26 20:29:23 -04:00
parent a59f7a4afc
commit d49f0fcac3
7 changed files with 29 additions and 25 deletions

View File

@@ -270,7 +270,7 @@ function initApiService() {
function handleError(errorCallback, jqXHR, textStatus, errorThrown) {
if (jqXHR.status === 401 || jqXHR.status === 403) {
chrome.runtime.sendMessage(null, { command: 'logout' });
chrome.runtime.sendMessage({ command: 'logout' });
return;
}

View File

@@ -14,12 +14,12 @@ function initSyncService() {
throw 'callback function required';
}
syncStarted();
var self = this;
self.syncStarted();
self.userService.isAuthenticated(function (isAuthenticated) {
if (!isAuthenticated) {
syncCompleted(false);
self.syncCompleted(false);
callback(false);
return;
}
@@ -43,7 +43,7 @@ function initSyncService() {
self.folderService.replace(folders, function () {
self.siteService.replace(sites, function () {
self.setLastSync(now, function () {
syncCompleted(true);
self.syncCompleted(true);
callback(true);
});
});
@@ -169,15 +169,15 @@ function initSyncService() {
});
};
function syncStarted() {
SyncService.prototype.syncStarted = function () {
this.syncInProgress = true;
chrome.runtime.sendMessage(null, { command: 'syncStarted' });
}
chrome.runtime.sendMessage({ command: 'syncStarted' });
};
function syncCompleted(successfully) {
SyncService.prototype.syncCompleted = function (successfully) {
this.syncInProgress = false;
chrome.runtime.sendMessage(null, { command: 'syncCompleted', successfully: successfully });
}
chrome.runtime.sendMessage({ command: 'syncCompleted', successfully: successfully });
};
function handleError() {
syncCompleted(false);