Skip to content
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

Merged
merged 22 commits into from
Apr 22, 2023
Merged

Feat/auth form #1

merged 22 commits into from
Apr 22, 2023

Conversation

ManuSanchez02
Copy link
Contributor

@ManuSanchez02 ManuSanchez02 commented Apr 7, 2023

Added login and register form and connected it to the API gateway

@ManuSanchez02 ManuSanchez02 self-assigned this Apr 7, 2023
@ManuSanchez02 ManuSanchez02 marked this pull request as ready for review April 7, 2023 22:54
app/AuthForm.tsx Outdated
});
const data = await res.json();

console.log(data);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use custom logger here!

Copy link
Contributor Author

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
Comment on lines 19 to 26
const res = await fetch("http://localhost:8080/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: body,
});
const data = await res.json();

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.

Copy link
Contributor Author

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
Comment on lines 37 to 59
<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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use English!

Copy link
Contributor Author

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

Comment on lines 25 to 32
const res = await fetch("http://localhost:8080/auth/register", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: body,
});
const data = await res.json();

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listo

Comment on lines 44 to 73
<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"
/>

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, english!

Copy link
Contributor Author

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

...formData,
role: ADMIN_ROLE,
};
const body = JSON.stringify(registerData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no hace falta

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment on lines 59 to 61
headers: {
"Content-Type": "application/json",
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tampoco

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@ianshih2003 ianshih2003 merged commit 128ab6b into main Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants