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
62193ef5
authored
Aug 28, 2025
by
Alba María Álvarez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(views): añadida funcionalidad a la vista Register
parent
f15a2d2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
src/views/Login.vue
src/views/Register.vue
src/views/Login.vue
View file @
62193ef5
...
...
@@ -62,7 +62,7 @@ const errorMsg = ref('');
async
function
handleLogin
()
{
errorMsg
.
value
=
''
;
try
{
await
authStore
.
login
({
email
:
email
.
value
,
password
:
password
.
value
})
,
await
authStore
.
login
({
email
:
email
.
value
,
password
:
password
.
value
})
;
router
.
push
(
'/recipes'
);
}
catch
(
error
)
{
errorMsg
.
value
=
error
.
message
;
...
...
src/views/Register.vue
View file @
62193ef5
<
script
setup
>
import
SignLayout
from
'@/components/SignLayout.vue'
;
</
script
>
<
template
>
<SignLayout>
<div
class=
"form-signin w-100 p-5 shadow rounded bg-white form-card"
>
<h2
class=
"mb-4 text-center"
>
Registrarse
</h2>
<form>
<form
@
submit
.
prevent=
"handleRegister"
>
<div
class=
"form-floating mb-4"
>
<input
type=
"text"
class=
"form-control"
id=
"inputName"
placeholder=
"Nombre"
v-model=
"name"
required
>
<label
for=
"inputName"
>
Nombre
</label>
...
...
@@ -25,6 +22,7 @@ import SignLayout from '@/components/SignLayout.vue';
class=
"form-control"
id=
"inputSurname"
placeholder=
"Apellidos"
v-model=
"surname"
required
>
<label
for=
"inputSurname"
>
Apellidos
</label>
...
...
@@ -36,6 +34,7 @@ import SignLayout from '@/components/SignLayout.vue';
class=
"form-control"
id=
"inputEmail"
placeholder=
"Correo electrónico"
v-model=
"email"
required
>
<label
for=
"inputEmail"
>
Correo electrónico
</label>
...
...
@@ -47,6 +46,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>
...
...
@@ -65,6 +65,38 @@ 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
name
=
ref
(
''
);
const
surname
=
ref
(
''
);
const
email
=
ref
(
''
);
const
password
=
ref
(
''
);
const
errorMsg
=
ref
(
''
);
async
function
handleRegister
()
{
errorMsg
.
value
=
''
;
try
{
await
authStore
.
register
({
name
:
name
.
value
,
surname
:
surname
.
value
,
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