Arreglado error de ts

This commit is contained in:
2025-12-01 22:37:24 -03:00
parent c2c8bd58a8
commit 4b1f6c9f7a
2 changed files with 8 additions and 8 deletions

View File

@@ -8,17 +8,17 @@
import Loader2Icon from '@lucide/svelte/icons/loader-2'; import Loader2Icon from '@lucide/svelte/icons/loader-2';
let { id, showAlert = $bindable() } = $props(); let { id, showAlert = $bindable() } = $props();
let dto: LoginDto = $state({password: "", username: ""}); let dto: LoginDto = $state({ password: '', username: '' });
const setAlert = () => showAlert = true; const setAlert = () => (showAlert = true);
let cargando = $state(false); let cargando = $state(false);
const handleSubmit = async (e: Event) => { const handleSubmit = async (e: SubmitEvent) => {
cargando = true; cargando = true;
await login(e, dto, setAlert); await login(e, dto, setAlert);
cargando = false; cargando = false;
} };
</script> </script>
<Card.Root class="mx-auto w-full max-w-sm"> <Card.Root class="mx-auto w-full max-w-sm">

View File

@@ -3,7 +3,7 @@ import type { LoginDto } from "../../types";
import { sesionStore } from "@/stores/usuario"; import { sesionStore } from "@/stores/usuario";
import { goto } from "$app/navigation"; import { goto } from "$app/navigation";
export async function login(e:FormDataEvent,dto: LoginDto, callbackfn:()=>void){ export async function login(e:SubmitEvent, dto: LoginDto, callbackfn:()=>void){
e.preventDefault(); e.preventDefault();
if (dto.password == "" || dto.username == "") return; if (dto.password == "" || dto.username == "") return;
try { try {