fix console errors
This commit is contained in:
parent
0bea38eebb
commit
3330273fbf
2 changed files with 36 additions and 42 deletions
|
@ -247,48 +247,43 @@ 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
|
e.preventDefault();
|
||||||
type="password"
|
const input = e.currentTarget.querySelector('input') as HTMLInputElement;
|
||||||
placeholder="Enter code"
|
if (input.value.trim()) {
|
||||||
className="input input-bordered flex-1"
|
setIsLoading(true);
|
||||||
onKeyPress={(e) => {
|
handleEventCheckIn(input.value.trim()).finally(() => {
|
||||||
if (e.key === "Enter") {
|
setIsLoading(false);
|
||||||
e.preventDefault();
|
input.value = "";
|
||||||
const input = e.target as HTMLInputElement;
|
});
|
||||||
if (input.value.trim()) {
|
} else {
|
||||||
setIsLoading(true);
|
createToast("Please enter an event code", "warning");
|
||||||
handleEventCheckIn(input.value.trim()).finally(() => {
|
}
|
||||||
setIsLoading(false);
|
}}>
|
||||||
input.value = "";
|
<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
|
||||||
<button
|
type="submit"
|
||||||
className={`btn btn-primary min-w-[90px] ${isLoading ? "loading" : ""}`}
|
className={`btn btn-primary min-w-[90px] ${isLoading ? "loading" : ""}`}
|
||||||
onClick={(e) => {
|
disabled={isLoading}
|
||||||
const input = e.currentTarget.previousElementSibling as HTMLInputElement;
|
>
|
||||||
if (input.value.trim()) {
|
{isLoading ? (
|
||||||
setIsLoading(true);
|
<span className="loading loading-spinner loading-xs"></span>
|
||||||
handleEventCheckIn(input.value.trim()).finally(() => {
|
) : (
|
||||||
setIsLoading(false);
|
"Check In"
|
||||||
input.value = "";
|
)}
|
||||||
});
|
</button>
|
||||||
} else {
|
</div>
|
||||||
createToast("Please enter an event code", "warning");
|
</form>
|
||||||
}
|
|
||||||
}}
|
|
||||||
disabled={isLoading}
|
|
||||||
>
|
|
||||||
{isLoading ? (
|
|
||||||
<span className="loading loading-spinner loading-xs"></span>
|
|
||||||
) : (
|
|
||||||
"Check In"
|
|
||||||
)}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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');
|
||||||
|
|
Loading…
Reference in a new issue