Skip to content

Commit

Permalink
Update ImageCard.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmio committed Aug 28, 2023
1 parent 5cb2bbe commit 365e078
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/ImageCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { deleteObject } from 'firebase/storage';
import { differenceInDays } from 'date-fns';
import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../utilities/error-analytics';
import { useDropzone } from 'react-dropzone';
import { showDeleteConfirmation } from '../components/Alert';

const ImageCard = ({ pumpkinId, pumpkinName }) => {
const [images, setImages] = useState([]);
Expand Down Expand Up @@ -180,7 +181,8 @@ const calculateDaysAfterPollination = async (pumpkinId, shareDate) => {
};

const handleDelete = async () => {
try {
showDeleteConfirmation('Delete Image', 'Are you sure you want to delete this image?', async () => {
try {
// Find the image object to delete
const imageToDelete = images.find(imageObj => imageObj.original === selectedImage);
if (!imageToDelete) return;
Expand Down

0 comments on commit 365e078

Please sign in to comment.