Add button to save without cropping

This commit is contained in:
jasper 2019-03-18 18:19:42 -07:00
parent 96f9eab700
commit 3108722eda
4 changed files with 32 additions and 2 deletions

View file

@ -158,7 +158,13 @@ const UserSettings = {
reader.readAsDataURL(file)
},
submitAvatar (cropper, file) {
const img = cropper.getCroppedCanvas().toDataURL(file.type)
let img
if (cropper) {
img = cropper.getCroppedCanvas().toDataURL(file.type)
} else {
img = file
}
return this.$store.state.api.backendInteractor.updateAvatar({ params: { img } }).then((user) => {
if (!user.error) {
this.$store.commit('addNewUsers', [user])