import type { RouteObject } from 'react-router'; import { useAppDispatch, useAppSelector } from '../../common/hooks'; import { useEffect } from 'react'; import { fetchCertificates, getCertificatesState } from '../../features'; import { CreateCertificate } from '../../features/certificates'; import { CertificateList } from '../../features/certificates/components/certificate-list'; export const Certificates = () => { const dispatch = useAppDispatch() const { loading, certificates } = useAppSelector(getCertificatesState) useEffect(()=>{ dispatch(fetchCertificates()) }, [dispatch]) return (

Add Certificate

Certificates List

{ loading && 'Loading...' } { certificates.length ? :

No certificates found

}
); }; export const CertificatesRoute: RouteObject = { path: '/certificates', Component: Certificates, };