import React, { useEffect, useState } from "react"; import styles from "./ListReports.module.css"; import HttpService from "../../scripts/net/HttpService.js"; import config from "../../scripts/net/netconfig.js"; import {Link} from "react-router-dom"; const ListReports = () => { const [isModalOpen, setIsModalOpen] = useState(false); const [reports, setReports] = useState([]); useEffect(() => { const loadReports = async () => { try { const httpService = new HttpService(true); httpService.setAuthenticated(); const respReports = await httpService.get(config.admin.load_reports); const sortedReports = respReports.sort( (a, b) => new Date(b.date) - new Date(a.date) ); setReports(sortedReports); } catch (error) { console.error("Error loading reports:", error); } }; loadReports(); }, []); const handleButtonClick = () => { setIsModalOpen(true); }; const handleCloseModal = () => { setIsModalOpen(false); }; return (
No reports available
)}