Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Alba María Álvarez
/
front_recipes
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
88e2c14a
authored
Aug 26, 2025
by
Alba María Álvarez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(Login): aplicada funcionalidad al formulario de Login
parent
18bd20e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
7 deletions
src/views/Login.vue
src/views/Login.vue
View file @
88e2c14a
<
script
setup
>
import
Header
from
'@/components/Header.vue'
;
import
SignLayout
from
'@/components/SignLayout.vue'
;
</
script
>
<
template
>
<Header></Header>
<SignLayout>
<div
class=
"form-signin w-100 p-5 shadow rounded bg-white form-card"
>
<h2
class=
"mb-4 text-center"
>
Iniciar Sesión
</h2>
<form>
<form
@
submit
.
prevent=
"handleLogin"
>
<div
class=
"form-floating mb-4"
>
<input
type=
"email"
class=
"form-control"
id=
"inputEmail"
placeholder=
"Correo electrónico"
v-model=
"email"
required
>
<label
for=
"inputEmail"
>
Correo electrónico
</label>
...
...
@@ -27,6 +22,7 @@ import SignLayout from '@/components/SignLayout.vue';
class=
"form-control"
id=
"inputPassword"
placeholder=
"Contraseña"
v-model=
"password"
required
>
<label
for=
"inputPassword"
>
Contraseña
</label>
...
...
@@ -36,6 +32,10 @@ import SignLayout from '@/components/SignLayout.vue';
Entrar
</button>
<div
v-if=
"errorMsg"
class=
"alert alert-danger"
role=
"alert"
>
{{
errorMsg
}}
</div>
<p
class=
"text-center mt-4"
>
¿No tienes cuenta?
<a
href=
"/auth/register"
class=
"text-decoration-none"
>
Regístrate aquí
</a>
...
...
@@ -45,6 +45,31 @@ import SignLayout from '@/components/SignLayout.vue';
</SignLayout>
</
template
>
<
script
setup
>
import
SignLayout
from
'@/components/SignLayout.vue'
;
import
{
useAuthStore
}
from
'@/stores/authStore'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
ref
}
from
'vue'
;
const
authStore
=
useAuthStore
();
const
router
=
useRouter
();
const
email
=
ref
(
''
);
const
password
=
ref
(
''
);
const
errorMsg
=
ref
(
''
);
async
function
handleLogin
()
{
errorMsg
.
value
=
''
;
try
{
await
authStore
.
login
({
email
:
email
.
value
,
password
:
password
.
value
}),
router
.
push
(
'/recipes'
);
}
catch
(
error
)
{
errorMsg
.
value
=
error
.
message
;
}
}
</
script
>
<
style
scope
>
.form-card
.btn-style
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment