delete items on signout

This commit is contained in:
Mo Bitar
2017-01-13 00:50:20 -06:00
parent 0130fae17d
commit 86b6ac0d58
5 changed files with 39 additions and 10 deletions

View File

@@ -88,8 +88,9 @@ angular.module('app.frontend')
this.signOutPressed = function() {
this.showAccountMenu = false;
apiController.signout();
window.location.reload();
apiController.signout(function(){
window.location.reload();
})
}
this.submitPasswordChange = function() {

View File

@@ -571,8 +571,11 @@ angular.module('app.frontend')
localStorage.setItem('mk', mk);
}
this.signout = function() {
localStorage.clear();
this.signout = function(callback) {
dbManager.clearAllItems(function(){
localStorage.clear();
callback();
});
}
this.encryptSingleItem = function(item, masterKey) {

View File

@@ -115,6 +115,16 @@ class DBManager {
};
}, null);
}
clearAllItems(callback) {
this.openDatabase((db) => {
var request = db.transaction("items", "readwrite").objectStore("items").clear();
request.onsuccess = function(event) {
console.log("Successfully cleared items");
callback();
};
}, null)
}
}
angular.module('app.frontend').service('dbManager', DBManager);