Modulo makers3d desarrollado con codex V 0.0.1

This commit is contained in:
Ryuk Mike
2026-07-29 23:58:58 +02:00
commit 2bedf7cbb7
171 changed files with 29421 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
"use client";
import { useState } from "react";
import { browserFetch } from "../lib/api";
import { notifyAuthChanged } from "../lib/authEvents";
export default function RegisterForm({ redirectTo = "/account" }: { redirectTo?: string }) {
const [error, setError] = useState("");
const [form, setForm] = useState({ fullName: "", email: "", password: "" });
async function onSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
setError("");
try {
await browserFetch("/auth/register", {
method: "POST",
body: JSON.stringify(form)
});
notifyAuthChanged("login");
window.location.href = redirectTo;
} catch (submitError) {
setError(submitError instanceof Error ? submitError.message : "No se pudo crear la cuenta");
}
}
return (
<form className="stack" onSubmit={onSubmit}>
<input className="field" placeholder="Nombre completo" value={form.fullName} onChange={(event) => setForm((current) => ({ ...current, fullName: event.target.value }))} required />
<input className="field" type="email" placeholder="Correo" value={form.email} onChange={(event) => setForm((current) => ({ ...current, email: event.target.value }))} required />
<input className="field" type="password" placeholder="Contrasena" value={form.password} onChange={(event) => setForm((current) => ({ ...current, password: event.target.value }))} required />
<button className="button button-primary" type="submit">Crear cuenta</button>
{error ? <p className="muted">{error}</p> : null}
</form>
);
}