import Link from 'next/link'; import { useEffect, useState } from 'react'; import { useFetchWithAuth } from '../../hooks/useFetchWithAuth'; interface Props { endpoint: string columns:string [] } const TableBody = ({ columns,endpoint }:Props) => { let defaultData:[] = []; const [entities, setEntities] = useState(defaultData); const getInitData = async () => { const { data, error } = await useFetchWithAuth(endpoint); if (!error) { setEntities(data); } else { console.log(error) } } useEffect(() => { getInitData(); }, [endpoint]) return (
{ entities.map((entity) => { return (