// Modules import { v4 as uuidv4 } from "uuid"; import { useState, useEffect } from "react"; import { IconContext } from "react-icons"; import { Link } from "react-router-dom"; // Icons import { FaSourcetree } from "react-icons/fa"; import { FaRegEdit } from "react-icons/fa"; import { FaTrash } from "react-icons/fa"; import { getLinks } from "../helpers/apiRequests"; // Helpers import { deleteLink } from "../helpers/apiRequests"; // Types import { LinksAll } from "../types/links"; // interface dataType { // createName: string; // createLink: string; // delete: number; // updateId: number; // updateName: string; // updateLink: string; // } // interface successType { // create: string; // delete: string; // update: string; // hasCreateUpdated: boolean; // hasDeleteUpdated: boolean; // hasUpdateUpdated: boolean; // } const Source = () => { const defaultDate = new Date("00-00-00"); const [deleted, setDeleted] = useState(false); const [all, setAll] = useState([ { id: -1, name: "", source: "", createdAt: defaultDate, updatedAt: defaultDate, }, ]); useEffect(() => { getLinks(setAll); }, []); useEffect(() => { if (deleted) { setTimeout(() => { setDeleted(false); getLinks(setAll); }, 2000); } }, [deleted, setDeleted]); return (

Source

All sources

{all[0].id !== -1 ? ( all.map((source: LinksAll) => { return ( ); }) ) : ( )}
ID Name Source Actions
{source.id} {source.name} {source.source}
Edit
); }; export default Source;