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
d61d8d9c
Commit
d61d8d9c
authored
3 years ago
by
Erik Borgeteien Hansen
Browse files
Options
Downloads
Patches
Plain Diff
fix not sending correct info bug
parent
40211e47
No related branches found
No related tags found
1 merge request
!10
Register view tailwind
Pipeline
#175468
passed
3 years ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/RegisterFormComponent.vue
+24
-22
24 additions, 22 deletions
src/components/RegisterFormComponent.vue
src/utils/apiutil.js
+3
-3
3 additions, 3 deletions
src/utils/apiutil.js
with
27 additions
and
25 deletions
src/components/RegisterFormComponent.vue
+
24
−
22
View file @
d61d8d9c
...
@@ -122,7 +122,6 @@ export default {
...
@@ -122,7 +122,6 @@ export default {
setup
:
()
=>
({
v
$
:
useVuelidate
()
}),
setup
:
()
=>
({
v
$
:
useVuelidate
()
}),
data
()
{
data
()
{
return
{
return
{
userCreated
:
false
,
loading
:
false
,
loading
:
false
,
email
:
""
,
email
:
""
,
pword
:
""
,
pword
:
""
,
...
@@ -151,34 +150,25 @@ export default {
...
@@ -151,34 +150,25 @@ export default {
},
},
methods
:
{
methods
:
{
async
submit
()
{
async
submit
()
{
console
.
log
(
this
.
$data
);
//Display loading symbol
this
.
loading
=
true
;
this
.
loading
=
true
;
const
result
=
await
this
.
v$
.
$validate
();
//Validate form
const
result
=
await
this
.
v$
.
$validate
();
if
(
!
result
)
{
if
(
!
result
)
{
//Invalid form
console
.
log
(
"
Form not submitted
"
);
this
.
loading
=
false
;
this
.
loading
=
false
;
return
;
return
;
}
}
const
registerInfo
=
{
//Send a request to create a user and save success as a bool
email
:
this
.
email
,
const
userCreated
=
await
this
.
sendRegisterRequest
();
firstName
:
this
.
fname
,
lastname
:
this
.
lname
,
password
:
this
.
pword
,
address
:
this
.
address
,
};
let
response
=
await
registerUser
(
registerInfo
);
if
(
response
.
status
===
200
)
this
.
userCreated
=
true
;
//If a user is created succsessfully, try to login
//If a user is created succsessfully, try to login
if
(
this
.
userCreated
)
{
//If we get this far, we will be pushed anyway so there is no point updating "loading"
if
(
userCreated
)
{
const
loginRequest
=
{
const
loginRequest
=
{
email
:
this
.
user
.
email
,
email
:
this
.
email
,
password
:
this
.
user
.
pass
word
,
password
:
this
.
p
word
,
};
};
const
loginResponse
=
await
doLogin
(
loginRequest
);
const
loginResponse
=
await
doLogin
(
loginRequest
);
...
@@ -189,12 +179,24 @@ export default {
...
@@ -189,12 +179,24 @@ export default {
this
.
$router
.
push
(
"
/login
"
);
this
.
$router
.
push
(
"
/login
"
);
return
;
return
;
}
}
this
.
$router
.
push
(
"
/
"
);
this
.
$store
.
commit
(
"
saveToken
"
,
loginResponse
);
this
.
$store
.
commit
(
"
saveToken
"
,
loginResponse
);
console
.
log
(
loginResponse
);
this
.
$router
.
push
(
"
/
"
);
}
}
this
.
loading
=
false
;
},
async
sendRegisterRequest
()
{
const
registerInfo
=
{
email
:
this
.
email
,
firstName
:
this
.
fname
,
lastname
:
this
.
lname
,
password
:
this
.
pword
,
address
:
this
.
address
,
};
const
response
=
await
registerUser
(
registerInfo
);
if
(
response
.
status
===
200
)
return
true
;
return
false
;
},
},
},
},
};
};
...
...
This diff is collapsed.
Click to expand it.
src/utils/apiutil.js
+
3
−
3
View file @
d61d8d9c
...
@@ -14,9 +14,9 @@ export function registerUser(registerInfo) {
...
@@ -14,9 +14,9 @@ export function registerUser(registerInfo) {
return
axios
return
axios
.
post
(
API_URL
+
"
register
"
,
{
.
post
(
API_URL
+
"
register
"
,
{
email
:
registerInfo
.
email
,
email
:
registerInfo
.
email
,
firstName
:
registerInfo
.
f
n
ame
,
firstName
:
registerInfo
.
f
irstN
ame
,
lastname
:
registerInfo
.
lname
,
lastname
:
registerInfo
.
l
ast
name
,
password
:
registerInfo
.
pword
,
password
:
registerInfo
.
p
ass
word
,
address
:
registerInfo
.
address
,
address
:
registerInfo
.
address
,
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
...
...
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