import { useState } from 'react' import { useRouter } from "next/router"; import axiosInstance from '../../src/axiosSecure'; import { TrashIcon } from "@heroicons/react/24/outline"; export default function LocationCard({ location }) { const router = useRouter(); const [isCardVisible, setIsCardVisible] = useState(true); const handleDelete = async (id) => { try { console.log("card: deleting location = ", id, "url: ", `/locations/${id}`); const response = await axiosInstance.delete(`/api/data/locations/${id}`); if (response.status === 200) { document.getElementById(`location-card-${id}`).classList.add('cardFadeOut'); setTimeout(() => setIsCardVisible(false), 300); } } catch (error) { console.log(JSON.stringify(error)); } }; return isCardVisible ? ( <>
{location.address}