Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
dd95e141
Commit
dd95e141
authored
3 years ago
by
Erik Borgeteien Hansen
Browse files
Options
Downloads
Patches
Plain Diff
add error message display for user
parent
d61d8d9c
No related branches found
Branches containing commit
No related tags found
Loading
Pipeline
#175515
passed
3 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/RegisterFormComponent.vue
+22
-17
22 additions, 17 deletions
src/components/RegisterFormComponent.vue
with
22 additions
and
17 deletions
src/components/RegisterFormComponent.vue
+
22
−
17
View file @
dd95e141
...
...
@@ -108,6 +108,7 @@
<strong>
{{
error
.
$message
}}
</strong>
</p>
</section>
<p
v-if=
"errorMessage"
>
{{
errorMessage
}}
</p>
</
template
>
<
script
>
...
...
@@ -122,6 +123,7 @@ export default {
setup
:
()
=>
({
v
$
:
useVuelidate
()
}),
data
()
{
return
{
errorMessage
:
""
,
loading
:
false
,
email
:
""
,
pword
:
""
,
...
...
@@ -165,24 +167,27 @@ export default {
//If a user is created succsessfully, try to login
//If we get this far, we will be pushed anyway so there is no point updating "loading"
if
(
userCreated
)
{
const
loginRequest
=
{
email
:
this
.
email
,
password
:
this
.
pword
,
};
const
loginResponse
=
await
doLogin
(
loginRequest
);
if
(
loginResponse
===
"
Failed login
"
)
{
this
.
message
=
"
kunne ikke logge inn
"
;
this
.
$store
.
commit
(
"
logout
"
);
this
.
$router
.
push
(
"
/login
"
);
return
;
}
this
.
$
store
.
commit
(
"
saveToken
"
,
loginResponse
);
this
.
$router
.
push
(
"
/
"
)
;
if
(
!
userCreated
)
{
this
.
errorMessage
=
"
Could not create user.
"
;
return
;
}
const
loginRequest
=
{
email
:
this
.
email
,
password
:
this
.
pword
,
};
const
loginResponse
=
await
doLogin
(
loginRequest
);
if
(
loginResponse
===
"
Failed login
"
)
{
this
.
errorMessage
=
"
Failed to log in with new user
"
;
this
.
$store
.
commit
(
"
logout
"
);
this
.
$
router
.
push
(
"
/login
"
);
return
;
}
this
.
$store
.
commit
(
"
saveToken
"
,
loginResponse
);
this
.
$router
.
push
(
"
/
"
);
},
async
sendRegisterRequest
()
{
const
registerInfo
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment