added initial capture popup UI, added ability to download capture

This commit is contained in:
Frank Noirot
2021-02-25 04:04:35 -05:00
parent 6e6425735f
commit 2ea8d5c2b5
5 changed files with 80 additions and 24 deletions

View File

@@ -5,19 +5,17 @@ const CLOUDINARY_UPLOAD_PRESET = 'CadHub_project_images'
const CLOUDINARY_UPLOAD_URL = 'https://api.cloudinary.com/v1_1/irevdev/upload'
export async function uploadToCloudinary(imgBlob) {
// const imageData = new FormData()
// imageData.append('upload_preset', CLOUDINARY_UPLOAD_PRESET)
// imageData.append('file', croppedFile)
// let upload = axios.post(CLOUDINARY_UPLOAD_URL, imageData)
const imageData = new FormData()
imageData.append('upload_preset', CLOUDINARY_UPLOAD_PRESET)
imageData.append('file', imgBlob)
let upload = axios.post(CLOUDINARY_UPLOAD_URL, imageData)
// try {
// const { data } = await upload
// if (data && data.public_id !== '') {
// onImageUpload({ cloudinaryPublicId: data.public_id })
// setCloudinaryId(data.public_id)
// setIsModalOpen(false)
// }
// } catch (e) {
// console.error('ERROR', e)
// }
try {
const { data } = await upload
if (data && data.public_id !== '') {
return data
}
} catch (e) {
console.error('ERROR', e)
}
}