2016-07-07 05:03:30 +08:00
|
|
|
import ko from 'ko';
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { change } from 'Common/Links';
|
2016-07-07 05:03:30 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
import { AbstractModel } from 'Knoin/AbstractModel';
|
2016-07-07 05:03:30 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
class AccountModel extends AbstractModel {
|
2016-07-07 05:03:30 +08:00
|
|
|
/**
|
|
|
|
* @param {string} email
|
|
|
|
* @param {boolean=} canBeDelete = true
|
|
|
|
* @param {number=} count = 0
|
|
|
|
*/
|
2019-07-05 03:19:24 +08:00
|
|
|
constructor(email, canBeDelete = true, count = 0) {
|
2016-07-07 05:03:30 +08:00
|
|
|
super('AccountModel');
|
|
|
|
|
|
|
|
this.email = email;
|
|
|
|
|
|
|
|
this.count = ko.observable(count);
|
|
|
|
|
|
|
|
this.deleteAccess = ko.observable(false);
|
|
|
|
this.canBeDeleted = ko.observable(!!canBeDelete);
|
|
|
|
this.canBeEdit = this.canBeDeleted;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
|
|
|
changeAccountLink() {
|
|
|
|
return change(this.email);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
export { AccountModel, AccountModel as default };
|