import { Button, Form } from 'antd'; import { useForm } from 'react-hook-form'; import { fetchReport } from '../api/reports'; import { FormInput } from '../components/formInput'; import { InputSelect } from '../components/inputSelect'; import { RadioInput } from '../components/radioInput'; import { withLayout } from '../layouts/main'; import { monthToList, ReportFormType, ReportType } from '../types/report'; function ReportPage() { // hooks const { control, handleSubmit, watch } = useForm({ defaultValues: { type: ReportType.monthly, year: new Date().getFullYear(), month: new Date().getMonth() } }); // Logic const onFinish = handleSubmit((data) => fetchReport(data)); const isMonthlyReport = watch('type') === ReportType.monthly; return ( <>

Reports

{isMonthlyReport && ( )} ); } export default withLayout(ReportPage);