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

@@ -6,19 +6,19 @@
import type { LoginDto } from '../../../../types'; import type { LoginDto } from '../../../../types';
import { login } from '@/hooks/login'; import { login } from '@/hooks/login';
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">
@@ -27,7 +27,7 @@
<Card.Description>ingrese su usuario para logearse en la cuenta</Card.Description> <Card.Description>ingrese su usuario para logearse en la cuenta</Card.Description>
</Card.Header> </Card.Header>
<Card.Content> <Card.Content>
<form onsubmit={handleSubmit}> <form onsubmit={handleSubmit}>
<FieldGroup> <FieldGroup>
<Field> <Field>
<FieldLabel for="email-{id}">Usuario</FieldLabel> <FieldLabel for="email-{id}">Usuario</FieldLabel>

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 {