This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/models/user.js
konrad d70aa1b21d
All checks were successful
continuous-integration/drone/push Build is passing
Add getting the user avatar from the api (#68)
Add getting the user avatar from the api

Co-authored-by: kolaente <k@knt.li>
Reviewed-on: #68
2020-03-01 20:30:54 +00:00

24 lines
479 B
JavaScript

import AbstractModel from './abstractModel'
import config from '../../public/config'
export default class UserModel extends AbstractModel {
constructor(data) {
super(data)
this.created = new Date(this.created)
this.updated = new Date(this.updated)
}
defaults() {
return {
id: 0,
email: '',
username: '',
created: null,
updated: null,
}
}
getAvatarUrl(size = 50) {
return `${config.VIKUNJA_API_BASE_URL}${this.username}/avatar?size=${size}`
}
}