1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

Few fixes to services and login

This commit is contained in:
Kyle Spearrin
2016-09-02 01:20:41 -04:00
parent 88c1c4b3dd
commit 8fafe2bd6d
6 changed files with 72 additions and 9 deletions

View File

@@ -2,6 +2,10 @@
var _service = {}, _token;
_service.setToken = function (token, callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
_token = token;
chrome.storage.local.set({
'authBearer': token
@@ -11,6 +15,10 @@
};
_service.getToken = function (callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
if (_token) {
return callback(_token);
}
@@ -25,6 +33,10 @@
};
_service.clearToken = function (callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
_token = null;
chrome.storage.local.remove('authBearer', function () {
callback();
@@ -32,4 +44,4 @@
};
return _service;
};
}();