clear namespace when removing profile
This commit is contained in:
parent
b51acf277f
commit
f5edb12d42
5 changed files with 35 additions and 10 deletions
|
|
@ -232,8 +232,28 @@ InsightStorage.prototype.removeItem = function(key, callback) {
|
|||
};
|
||||
|
||||
InsightStorage.prototype.clear = function(callback) {
|
||||
// NOOP
|
||||
callback();
|
||||
var passphrase = this.getPassphrase();
|
||||
var authHeader = new buffers.Buffer(this.email + ':' + passphrase).toString('base64');
|
||||
var deleteUrl = this.storeUrl + '/delete/profile';
|
||||
|
||||
log.debug('Clearing storage for: ' + this.email);
|
||||
this.request.post({
|
||||
url: deleteUrl,
|
||||
headers: {
|
||||
'Authorization': authHeader
|
||||
},
|
||||
body: null,
|
||||
}, function(err, response, body) {
|
||||
if (err) {
|
||||
return callback('Connection error');
|
||||
}
|
||||
if (response.statusCode === 409) {
|
||||
return callback('BADCREDENTIALS: Invalid username or password');
|
||||
} else if (response.statusCode !== 200) {
|
||||
return callback('Unable to remove data on insight');
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = InsightStorage;
|
||||
|
|
|
|||
|
|
@ -80,11 +80,7 @@ LocalStorage.prototype.removeItem = function(k, cb) {
|
|||
};
|
||||
|
||||
LocalStorage.prototype.clear = function(cb) {
|
||||
if (isChromeApp) {
|
||||
chrome.storage.clear();
|
||||
} else {
|
||||
this.ls.clear();
|
||||
}
|
||||
// NOP
|
||||
return cb();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue