fix console errors

This commit is contained in:
chark1es 2025-02-18 01:35:42 -08:00
parent 0bea38eebb
commit 3330273fbf
2 changed files with 36 additions and 42 deletions

View file

@ -247,29 +247,9 @@ const EventCheckIn = () => {
<label className="label"> <label className="label">
<span className="label-text">Enter event code to check in</span> <span className="label-text">Enter event code to check in</span>
</label> </label>
<div className="flex gap-2"> <form onSubmit={(e) => {
<input
type="password"
placeholder="Enter code"
className="input input-bordered flex-1"
onKeyPress={(e) => {
if (e.key === "Enter") {
e.preventDefault(); e.preventDefault();
const input = e.target as HTMLInputElement; const input = e.currentTarget.querySelector('input') as HTMLInputElement;
if (input.value.trim()) {
setIsLoading(true);
handleEventCheckIn(input.value.trim()).finally(() => {
setIsLoading(false);
input.value = "";
});
}
}
}}
/>
<button
className={`btn btn-primary min-w-[90px] ${isLoading ? "loading" : ""}`}
onClick={(e) => {
const input = e.currentTarget.previousElementSibling as HTMLInputElement;
if (input.value.trim()) { if (input.value.trim()) {
setIsLoading(true); setIsLoading(true);
handleEventCheckIn(input.value.trim()).finally(() => { handleEventCheckIn(input.value.trim()).finally(() => {
@ -279,7 +259,21 @@ const EventCheckIn = () => {
} else { } else {
createToast("Please enter an event code", "warning"); createToast("Please enter an event code", "warning");
} }
}}>
<div className="flex gap-2">
<input
type="password"
placeholder="Enter code"
className="input input-bordered flex-1"
onKeyPress={(e) => {
if (e.key === "Enter") {
e.preventDefault();
}
}} }}
/>
<button
type="submit"
className={`btn btn-primary min-w-[90px] ${isLoading ? "loading" : ""}`}
disabled={isLoading} disabled={isLoading}
> >
{isLoading ? ( {isLoading ? (
@ -289,6 +283,7 @@ const EventCheckIn = () => {
)} )}
</button> </button>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>

View file

@ -232,7 +232,6 @@ export default function Attendees() {
let isMounted = true; let isMounted = true;
const fetchEventData = async () => { const fetchEventData = async () => {
if (!eventId || !auth.isAuthenticated()) { if (!eventId || !auth.isAuthenticated()) {
if (!eventId) console.log('No eventId provided');
if (!auth.isAuthenticated()) { if (!auth.isAuthenticated()) {
console.log('User not authenticated'); console.log('User not authenticated');
setError('Authentication required'); setError('Authentication required');