-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/auth form #1
Conversation
app/AuthForm.tsx
Outdated
}); | ||
const data = await res.json(); | ||
|
||
console.log(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use custom logger here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me parece que hay un problema con el logger en un browser environment (winstonjs/winston#925 (comment)). Me esta tirando este error:
Import trace for requested module:
./node_modules/winston/dist/winston/transports/file.js
./node_modules/winston/dist/winston/transports/index.js
./node_modules/winston/dist/winston.js
./node_modules/@fiu-fit/common/dist/utils/logger-utility.js
./node_modules/@fiu-fit/common/dist/utils/index.js
./node_modules/@fiu-fit/common/dist/index.js
./app/AuthForm.tsx
wait - compiling /_error (client and server)...
error - ./node_modules/winston/dist/winston/tail-file.js:9:0
Module not found: Can't resolve 'fs'
No se si se te ocurre como solucionarlo o configure algo mal?
app/AuthForm.tsx
Outdated
const res = await fetch("http://localhost:8080/auth/login", { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: body, | ||
}); | ||
const data = await res.json(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use axios for this? We'll also need to not hard-code this URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Listo
app/AuthForm.tsx
Outdated
<FormInput | ||
name="email" | ||
label="Correo electrónico" | ||
type="text" | ||
className="col-span-2" | ||
/> | ||
<FormInput | ||
name="password" | ||
label="Contraseña" | ||
type="password" | ||
className="col-span-2" | ||
/> | ||
<button | ||
type="submit" | ||
className="text-white bg-blue-600 hover:bg-blue-700 col-span-2 button" | ||
> | ||
Iniciar sesión | ||
</button> | ||
<Link href="/register" className={`button ${styles.extra_button}`}> | ||
Registrarse | ||
</Link> | ||
<Link href="/forgot-password" className={`button ${styles.extra_button}`}> | ||
Recuperar contraseña |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use English!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decis que pongamos la UI en ingles? Me parece mejor dejarla en español por un tema de que la consigna esta en español tambien
app/register/RegisterForm.tsx
Outdated
const res = await fetch("http://localhost:8080/auth/register", { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: body, | ||
}); | ||
const data = await res.json(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here; use Axios & don't hard-code the URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Listo
app/register/RegisterForm.tsx
Outdated
<FormInput | ||
name="firstName" | ||
label="Nombre" | ||
type="text" | ||
className="col-span-2 sm:col-span-1" | ||
/> | ||
<FormInput | ||
name="lastName" | ||
label="Apellido" | ||
type="text" | ||
className="col-span-2 sm:col-span-1" | ||
/> | ||
<FormInput | ||
name="email" | ||
label="Email" | ||
type="text" | ||
className="col-span-2" | ||
/> | ||
<FormInput | ||
name="password" | ||
label="Contraseña" | ||
type="password" | ||
className="col-span-2" | ||
/> | ||
<FormInput | ||
name="passwordConfirmation" | ||
label="Confirmar contraseña" | ||
type="password" | ||
className="col-span-2" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor this, there's no need to repeat this much code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, english!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lo cambie, no me termina de convencer como quedo, acepto sugerencias :D
app/register/RegisterForm.tsx
Outdated
...formData, | ||
role: ADMIN_ROLE, | ||
}; | ||
const body = JSON.stringify(registerData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no hace falta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
app/register/RegisterForm.tsx
Outdated
headers: { | ||
"Content-Type": "application/json", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tampoco
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
…into feat/auth-form
Added login and register form and connected it to the API gateway