1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 14:23:32 +00:00

tuneing up mdoels and services for site add

This commit is contained in:
Kyle Spearrin
2016-09-05 01:49:44 -04:00
parent cc67d12c57
commit abb6f37af2
8 changed files with 141 additions and 114 deletions

View File

@@ -7,13 +7,13 @@
};
function initFolderService() {
this.userService.getUserId(function (userId) {
var foldersKey = 'folders_' + userId;
FolderService.prototype.get = function (id, callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
FolderService.prototype.get = function (id, callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
this.userService.getUserId(function (userId) {
var foldersKey = 'folders_' + userId;
chrome.storage.local.get(foldersKey, function (obj) {
var folders = obj[foldersKey];
@@ -24,12 +24,16 @@ function initFolderService() {
callback(null);
});
};
});
};
FolderService.prototype.getAll = function (callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
FolderService.prototype.getAll = function (callback) {
if (!callback || typeof callback !== 'function') {
throw 'callback function required';
}
this.userService.getUserId(function (userId) {
var foldersKey = 'folders_' + userId;
chrome.storage.local.get(foldersKey, function (obj) {
var folders = obj[foldersKey];
@@ -41,10 +45,10 @@ function initFolderService() {
callback(response);
});
};
});
};
function handleError() {
// TODO: check for unauth or forbidden and logout
}
});
function handleError() {
// TODO: check for unauth or forbidden and logout
}
};