mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-01 13:10:44 -03:00
Arreglado error de ts
This commit is contained in:
@@ -7,20 +7,19 @@
|
||||
import { register } from '@/hooks/register';
|
||||
import Loader2Icon from '@lucide/svelte/icons/loader-2';
|
||||
|
||||
let {showAlert = $bindable() } = $props();
|
||||
let { showAlert = $bindable() } = $props();
|
||||
|
||||
let cargando = $state(false);
|
||||
let cargando = $state(false);
|
||||
|
||||
const setAlert = () => showAlert = true;
|
||||
const setAlert = () => (showAlert = true);
|
||||
|
||||
let dto: RegisterDto = $state({ password: '', username: '', email: '', displayName: '' });
|
||||
|
||||
let dto: RegisterDto = $state({password: "", username: "", email:"", displayName: ""});
|
||||
|
||||
const handleSubmit = async (e: Event) => {
|
||||
cargando = true;
|
||||
await register(e, dto, setAlert);
|
||||
cargando = false;
|
||||
}
|
||||
const handleSubmit = async (e: SubmitEvent) => {
|
||||
cargando = true;
|
||||
await register(e, dto, setAlert);
|
||||
cargando = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<Card.Root>
|
||||
@@ -29,7 +28,7 @@ const handleSubmit = async (e: Event) => {
|
||||
<hr />
|
||||
</Card.Header>
|
||||
<Card.Content>
|
||||
<form onsubmit={handleSubmit}>
|
||||
<form onsubmit={handleSubmit}>
|
||||
<Field.Group>
|
||||
<Field.Field>
|
||||
<Field.Label for="name">Nombre de Usuario</Field.Label>
|
||||
@@ -43,7 +42,13 @@ const handleSubmit = async (e: Event) => {
|
||||
|
||||
<Field.Field>
|
||||
<Field.Label for="email">Email</Field.Label>
|
||||
<Input id="email" type="email" bind:value={dto.email} placeholder="m@ejemplo.com" required />
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
bind:value={dto.email}
|
||||
placeholder="m@ejemplo.com"
|
||||
required
|
||||
/>
|
||||
</Field.Field>
|
||||
<Field.Field>
|
||||
<Field.Label for="password">Contraseña</Field.Label>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { apiBase } from "@/stores/url";
|
||||
import { goto } from "$app/navigation";
|
||||
import type { RegisterDto } from "../../types";
|
||||
|
||||
export async function register(e:FormDataEvent,dto: RegisterDto, callbackfn:()=>void){
|
||||
export async function register(e: SubmitEvent, dto: RegisterDto, callbackfn:()=>void){
|
||||
e.preventDefault();
|
||||
if (dto.password == "" || dto.username == "" ||
|
||||
!dto.email?.includes("@") || dto.displayName=="") return;
|
||||
|
||||
Reference in New Issue
Block a user