delete items on signout
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user