Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hdastageeri
hft_awado_app
Commits
f38dbf6a
Commit
f38dbf6a
authored
Nov 28, 2019
by
gap95
Browse files
Api Integrated for registration button
parent
f815aaa4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/app/auth/register/register.page.ts
View file @
f38dbf6a
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
RestService
}
from
'
src/app/rest.service
'
;
import
{
Router
}
from
'
@angular/router
'
;
@
Component
({
selector
:
'
app-register
'
,
...
...
@@ -7,14 +10,33 @@ import { Observable } from 'rxjs';
styleUrls
:
[
'
./register.page.scss
'
],
})
export
class
RegisterPage
implements
OnInit
{
httpClient
:
any
;
registerApi
:
Observable
<
any
>
;
restService
:
any
;
router
:
any
;
correctCredentials
:
boolean
;
constructor
()
{
}
email
:
""
;
password
:
""
;
lastName
:
""
;
firstName
:
""
;
constructor
(
private
router
:
Router
,
public
httpClient
:
HttpClient
,
public
restService
:
RestService
)
{
}
ngOnInit
()
{
}
submitRegister
()
{
this
.
registerApi
=
this
.
httpClient
.
post
(
'
http://193.196.52.237:8081/register
'
,
{
"
email
"
:
this
.
email
,
"
password
"
:
this
.
password
,
"
firstname
"
:
this
.
firstName
,
"
lastname
"
:
this
.
lastName
});
this
.
registerApi
.
subscribe
((
data
)
=>
{
console
.
log
(
'
my data:
'
,
data
);
this
.
restService
.
setToken
(
data
.
token
);
this
.
router
.
navigateByUrl
(
'
/home
'
);
},
(
error
)
=>
{
console
.
log
(
error
);
this
.
correctCredentials
=
true
;
});
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment