From 3330273fbf8a906da18accb941cae172a9150e82 Mon Sep 17 00:00:00 2001 From: chark1es Date: Tue, 18 Feb 2025 01:35:42 -0800 Subject: [PATCH] fix console errors --- .../dashboard/EventsSection/EventCheckIn.tsx | 77 +++++++++---------- .../Officer_EventManagement/Attendees.tsx | 1 - 2 files changed, 36 insertions(+), 42 deletions(-) diff --git a/src/components/dashboard/EventsSection/EventCheckIn.tsx b/src/components/dashboard/EventsSection/EventCheckIn.tsx index 9f38ee3..a4a5f01 100644 --- a/src/components/dashboard/EventsSection/EventCheckIn.tsx +++ b/src/components/dashboard/EventsSection/EventCheckIn.tsx @@ -247,48 +247,43 @@ const EventCheckIn = () => { -
- { - if (e.key === "Enter") { - e.preventDefault(); - const input = e.target as HTMLInputElement; - if (input.value.trim()) { - setIsLoading(true); - handleEventCheckIn(input.value.trim()).finally(() => { - setIsLoading(false); - input.value = ""; - }); +
{ + e.preventDefault(); + const input = e.currentTarget.querySelector('input') as HTMLInputElement; + if (input.value.trim()) { + setIsLoading(true); + handleEventCheckIn(input.value.trim()).finally(() => { + setIsLoading(false); + input.value = ""; + }); + } else { + createToast("Please enter an event code", "warning"); + } + }}> +
+ { + if (e.key === "Enter") { + e.preventDefault(); } - } - }} - /> - -
+ }} + /> + +
+ diff --git a/src/components/dashboard/Officer_EventManagement/Attendees.tsx b/src/components/dashboard/Officer_EventManagement/Attendees.tsx index 2deb387..03f80e6 100644 --- a/src/components/dashboard/Officer_EventManagement/Attendees.tsx +++ b/src/components/dashboard/Officer_EventManagement/Attendees.tsx @@ -232,7 +232,6 @@ export default function Attendees() { let isMounted = true; const fetchEventData = async () => { if (!eventId || !auth.isAuthenticated()) { - if (!eventId) console.log('No eventId provided'); if (!auth.isAuthenticated()) { console.log('User not authenticated'); setError('Authentication required');