ec1b039daa
Reload the avatar after changing it Hide cropper after upload Fix aspect ratio Add loading variable Move avatar settings to seperate component Add avatar crop Fix avatar upload Add avatar file upload Add abstract methods for file upload Add saving avatar status Add avatar setting Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/200
29 lines
No EOL
548 B
JavaScript
29 lines
No EOL
548 B
JavaScript
import AbstractService from './abstractService'
|
|
import AvatarModel from '../models/avatar'
|
|
|
|
export default class AvatarService extends AbstractService {
|
|
constructor() {
|
|
super({
|
|
get: '/user/settings/avatar',
|
|
update: '/user/settings/avatar',
|
|
create: '/user/settings/avatar/upload',
|
|
})
|
|
}
|
|
|
|
modelFactory(data) {
|
|
return new AvatarModel(data)
|
|
}
|
|
|
|
useCreateInterceptor() {
|
|
return false
|
|
}
|
|
|
|
create(blob) {
|
|
return this.uploadBlob(
|
|
this.paths.create,
|
|
blob,
|
|
'avatar',
|
|
'avatar.jpg', // This fails without a file name
|
|
)
|
|
}
|
|
} |