From e49f9442cc1ab348b936d7b524ee16fee78cffea Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 15 Nov 2020 05:08:09 +0300 Subject: feat: clear EventForm after submit --- src/containers/BsuFantomSection/EventForm.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/containers') diff --git a/src/containers/BsuFantomSection/EventForm.tsx b/src/containers/BsuFantomSection/EventForm.tsx index e52dc5d..de3adc7 100644 --- a/src/containers/BsuFantomSection/EventForm.tsx +++ b/src/containers/BsuFantomSection/EventForm.tsx @@ -9,7 +9,7 @@ interface PropTypes { const EventForm: React.FC = ({ mutate }) => { const [name, setName] = useState(''); - const [date, setDate] = useState(''); + const [date, setDate] = useState((new Date()).toLocaleDateString()); const [attendanceId, setAttendanceId] = useState(''); const [conferenceId, setConferenceId] = useState(''); @@ -26,6 +26,12 @@ const EventForm: React.FC = ({ mutate }) => { conferenceId, participants: [] } + + setName(''); + setAttendanceId(''); + setConferenceId(''); + setDate(''); + return post('/events', event).then(() => mutate()); } } -- cgit v1.2.3