diff --git a/src/views/CameraCapture.vue b/src/views/CameraCapture.vue index f9941ff..0f7146b 100644 --- a/src/views/CameraCapture.vue +++ b/src/views/CameraCapture.vue @@ -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) })