1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

purge cache when local changes happen

This commit is contained in:
Kyle Spearrin 2016-09-16 23:52:50 -04:00
parent ac4d5836b2
commit 69ea468716
2 changed files with 19 additions and 1 deletions

View File

@ -118,6 +118,8 @@ function initFolderService() {
throw 'callback function required';
}
var self = this;
userService.getUserId(function (userId) {
var foldersKey = 'folders_' + userId;
@ -139,6 +141,7 @@ function initFolderService() {
obj[foldersKey] = folders;
chrome.storage.local.set(obj, function () {
self.decryptedFolderCache = null;
callback();
});
});
@ -150,10 +153,13 @@ function initFolderService() {
throw 'callback function required';
}
var self = this;
userService.getUserId(function (userId) {
var obj = {};
obj['folders_' + userId] = folders;
chrome.storage.local.set(obj, function () {
self.decryptedFolderCache = null;
callback();
});
});
@ -164,6 +170,8 @@ function initFolderService() {
throw 'callback function required';
}
var self = this;
userService.getUserId(function (userId) {
var foldersKey = 'folders_' + userId;
@ -191,6 +199,7 @@ function initFolderService() {
obj[foldersKey] = folders;
chrome.storage.local.set(obj, function () {
self.decryptedFolderCache = null;
callback();
});
});

View File

@ -139,6 +139,8 @@ function initSiteService() {
throw 'callback function required';
}
var self = this;
userService.getUserId(function (userId) {
var sitesKey = 'sites_' + userId;
@ -160,6 +162,7 @@ function initSiteService() {
obj[sitesKey] = sites;
chrome.storage.local.set(obj, function () {
self.decryptedSiteCache = null;
callback();
});
});
@ -171,10 +174,13 @@ function initSiteService() {
throw 'callback function required';
}
var self = this;
userService.getUserId(function (userId) {
var obj = {};
obj['sites_' + userId] = sites;
chrome.storage.local.set(obj, function () {
self.decryptedSiteCache = null;
callback();
});
});
@ -185,6 +191,8 @@ function initSiteService() {
throw 'callback function required';
}
var self = this;
userService.getUserId(function (userId) {
var sitesKey = 'sites_' + userId;
@ -212,6 +220,7 @@ function initSiteService() {
obj[sitesKey] = sites;
chrome.storage.local.set(obj, function () {
self.decryptedSiteCache = null;
callback();
});
});
@ -234,7 +243,7 @@ function initSiteService() {
};
function handleError(error, deferred) {
if (error.status == 401 || error.status == 403) {
if (error.status === 401 || error.status === 403) {
// TODO: logout
}