vikunja-frontend/src/services/avatar.js
konrad ec1b039daa More avatar providers (#200)
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
2020-08-02 17:17:29 +00:00

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
)
}
}