2019-03-02 10:25:10 +00:00
|
|
|
import AbstractModel from './abstractModel'
|
2020-03-01 20:30:54 +00:00
|
|
|
import config from '../../public/config'
|
2019-03-02 10:25:10 +00:00
|
|
|
|
|
|
|
export default class UserModel extends AbstractModel {
|
2020-02-08 13:16:06 +00:00
|
|
|
constructor(data) {
|
|
|
|
super(data)
|
|
|
|
this.created = new Date(this.created)
|
|
|
|
this.updated = new Date(this.updated)
|
|
|
|
}
|
|
|
|
|
2019-03-02 10:25:10 +00:00
|
|
|
defaults() {
|
|
|
|
return {
|
|
|
|
id: 0,
|
|
|
|
email: '',
|
|
|
|
username: '',
|
2020-02-08 13:16:06 +00:00
|
|
|
created: null,
|
|
|
|
updated: null,
|
2019-03-02 10:25:10 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-09 12:28:33 +00:00
|
|
|
|
|
|
|
getAvatarUrl(size = 50) {
|
2020-03-01 20:30:54 +00:00
|
|
|
return `${config.VIKUNJA_API_BASE_URL}${this.username}/avatar?size=${size}`
|
2020-02-09 12:28:33 +00:00
|
|
|
}
|
2019-03-02 10:25:10 +00:00
|
|
|
}
|