1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

setting up more models and services

This commit is contained in:
Kyle Spearrin
2016-09-03 12:07:30 -04:00
parent c39aab4ee7
commit c3053ea3a7
7 changed files with 323 additions and 95 deletions

41
src/models/dataModels.js Normal file
View File

@@ -0,0 +1,41 @@
var FolderData = function (response, userId) {
var data = null;
if (response instanceof FolderResponse) {
data = response;
}
else if (response instanceof CipherResponse) {
data = response.Data;
}
else {
throw 'unsupported instance';
}
this.id = response.Id;
this.userId = userId;
this.name = data.Name;
this.revisionDate = response.RevisionDate;
};
var SiteData = function (response, userId) {
var data = null;
if (response instanceof SiteResponse) {
data = response;
}
else if (response instanceof CipherResponse) {
data = response.Data;
}
else {
throw 'unsupported instance';
}
this.id = response.Id;
this.folderId = response.FolderId;
this.userId = userId;
this.name = data.Name;
this.uri = data.Uri;
this.username = data.Username;
this.password = data.Password;
this.notes = data.Notes;
this.favorite = response.Favorite;
this.revisionDate = response.RevisionDate;
};