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