import React, { useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; import CollectionSelection from "@/components/InputSelect/CollectionSelection"; import TagSelection from "@/components/InputSelect/TagSelection"; import TextInput from "@/components/TextInput"; import unescapeString from "@/lib/client/unescapeString"; import useLinkStore from "@/store/links"; import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import toast from "react-hot-toast"; import Link from "next/link"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faLink, faTrashCan } from "@fortawesome/free-solid-svg-icons"; import Modal from "../Modal"; type Props = { onClose: Function; activeLink: LinkIncludingShortenedCollectionAndTags; }; export default function DeleteLinkModal({ onClose, activeLink }: Props) { const [link, setLink] = useState(activeLink); const { removeLink } = useLinkStore(); const [submitLoader, setSubmitLoader] = useState(false); useEffect(() => { setLink(activeLink); }, []); const deleteLink = async () => { const load = toast.loading("Deleting..."); const response = await removeLink(link.id as number); toast.dismiss(load); response.ok && toast.success(`Link Deleted.`); onClose(); }; return (

Delete Link

Are you sure you want to delete this Link?

Warning: This action is irreversible!

Hold the Shift key while clicking 'Delete' to bypass this confirmation in the future.

); }