diff options
Diffstat (limited to 'modern/src/reports/EventReportPage.js')
-rw-r--r-- | modern/src/reports/EventReportPage.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 3e12af98..a0ba5f09 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -10,17 +10,13 @@ const ReportFilterForm = ({ onResult }) => { const [eventType, setEventType] = useState(['allEvents']); const handleSubmit = async (deviceId, from, to) => { - const query = new URLSearchParams({ - deviceId, - from: from.toISOString(), - to: to.toISOString(), - }); - eventType.map(t=>query.append('type',t)); + const query = new URLSearchParams({ deviceId, from, to }); + eventType.map(it => query.append('type', it)); const response = await fetch(`/api/reports/events?${query.toString()}`, { headers: { Accept: 'application/json' } }); - if(response.ok) { + if (response.ok) { onResult(await response.json()); } - } + }; return ( <ReportFilter handleSubmit={handleSubmit}> |