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:
41
src/models/dataModels.js
Normal file
41
src/models/dataModels.js
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user