add autocrop to photo capture

This commit is contained in:
MarcZierle 2022-01-24 10:17:35 +01:00
parent 2fa9b70bc2
commit 42a089eedb

View File

@ -87,7 +87,7 @@ import {darkTheme} from 'naive-ui'
import CreateNewFolderRound from '@vicons/material/CreateNewFolderRound'
import HandPointUp from '@vicons/fa/HandPointUp'
import { getPhotoGroups, addNewPhotoGroup, addNewPhoto } from '@/api'
import { getPhotoGroups, addNewPhotoGroup, addNewPhoto, cropPhoto } from '@/api'
export default {
components: {
@ -248,11 +248,19 @@ export default {
const file = dataURLtoFile(this.photo.src, 'upload.png')
addNewPhoto(file, null, this.selected_group).then(() => {
addNewPhoto(file, null, this.selected_group).then((response) => {
this.message.success('Done!')
this.isPhotoTaken = false
this.showPhotoTakenModal = false
this.isUploading = false
setTimeout(() => {
cropPhoto(response.data.id, 'auto').then(()=>{
console.log('photo has been cropped')
}).catch((error)=>{
console.error(error)
})
}, 100)
}).catch((error) => {
this.message.error('There was an error uploading the photo: ' + error)
})