Skip to content

Commit

Permalink
Merge pull request #8 from MaryanneG3/homepage
Browse files Browse the repository at this point in the history
bug fixes - drag and drop imamge not being sent to custom vision api
  • Loading branch information
MaryanneG3 authored Nov 25, 2024
2 parents 0423d0e + d00d7df commit ccd879a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/pages/cars/insurancepage/InsuranceQuote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ function InsuranceQuote() {
// DRAG and DROP Handling
const handleDrop = (event) => {
event.preventDefault();
const file = e.dataTransfer.files[0];
const file = event.dataTransfer.files[0];

if (file) {
if (file && file.type.startsWith("image/")) {
// Ensure it's an image file
setImage(URL.createObjectURL(file));
sendToPredictionAPI(file);
} else {
console.error("Only image files are allowed.");
}
};

const handleDrag = (e) => {
e.preventDefault();
const handleDrag = (event) => {
event.preventDefault();
event.dataTransfer.dropEffect = "copy"; // Indicate a copy operation
};

// send image to api
Expand Down

0 comments on commit ccd879a

Please sign in to comment.