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
kolaente 6688dac2c6
Some checks reported errors
continuous-integration/drone/push Build was killed
Change avatar endpoint
2020-12-18 23:11:23 +01:00

32 lines
537 B
JavaScript

import AbstractModel from './abstractModel'
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: '',
name: '',
created: null,
updated: null,
}
}
getAvatarUrl(size = 50) {
return `${window.API_URL}/avatar/${this.username}?size=${size}`
}
getDisplayName() {
if (this.name !== '') {
return this.name
}
return this.username
}
}