- fixed but to delete specific alert item
- need to remove rawcamebase from config in prod
This commit is contained in:
@@ -16,7 +16,7 @@ type SightingModalProps = {
|
||||
isSightingModalOpen: boolean;
|
||||
handleClose: () => void;
|
||||
sighting: SightingType | null;
|
||||
onDelete?: () => void;
|
||||
onDelete?: (deletedItem: SightingType | null) => void;
|
||||
};
|
||||
|
||||
const SightingModal = ({
|
||||
@@ -47,6 +47,7 @@ const SightingModal = ({
|
||||
path: "alertHistory",
|
||||
value: sighting,
|
||||
});
|
||||
toast.success("Sighting Successfully added to alert list");
|
||||
}
|
||||
|
||||
dispatch({ type: "ADD", payload: sighting });
|
||||
@@ -58,9 +59,9 @@ const SightingModal = ({
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteClick = () => {
|
||||
const handleDeleteClick = (deletedItem: SightingType | null) => {
|
||||
if (!onDelete) return;
|
||||
onDelete();
|
||||
onDelete(deletedItem);
|
||||
handleClose();
|
||||
toast.success("Sighting removed from alert list");
|
||||
};
|
||||
@@ -84,7 +85,7 @@ const SightingModal = ({
|
||||
{onDelete ? (
|
||||
<button
|
||||
className="inline-flex items-center justify-center gap-2 rounded-lg px-5 py-3 bg-red-600 text-white hover:bg-red-700 w-full md:w-full"
|
||||
onClick={handleDeleteClick}
|
||||
onClick={() => handleDeleteClick(sighting)}
|
||||
>
|
||||
<FontAwesomeIcon icon={faTrash} />
|
||||
Delete
|
||||
@@ -234,7 +235,7 @@ const SightingModal = ({
|
||||
{onDelete ? (
|
||||
<button
|
||||
className="inline-flex items-center justify-center gap-2 rounded-lg px-5 py-3 bg-red-600 text-white hover:bg-red-700 w-full md:w-full"
|
||||
onClick={handleDeleteClick}
|
||||
onClick={() => handleDeleteClick(sighting)}
|
||||
>
|
||||
<FontAwesomeIcon icon={faTrash} />
|
||||
Delete
|
||||
|
||||
Reference in New Issue
Block a user