diff --git a/src/app/pages/login.component.html b/src/app/pages/login.component.html index 08c281e..c9c29b5 100644 --- a/src/app/pages/login.component.html +++ b/src/app/pages/login.component.html @@ -7,13 +7,14 @@

Login

Sign In to your account

+
- - + @ +
- +
@@ -23,6 +24,7 @@
+
diff --git a/src/app/pages/login.component.ts b/src/app/pages/login.component.ts index 46046d4..ae9dfa4 100644 --- a/src/app/pages/login.component.ts +++ b/src/app/pages/login.component.ts @@ -1,10 +1,49 @@ import { Component } from '@angular/core'; +import { Validators, FormBuilder, FormGroup } from '@angular/forms'; +import { Http, Response } from '@angular/http'; +import { ApiService } from '../providers/api-service'; +import 'rxjs/add/operator/map'; @Component({ - templateUrl: 'login.component.html' + templateUrl: 'login.component.html', + providers: [ApiService] }) export class LoginComponent { + signin: FormGroup; + ageRanges: Object[]; + + constructor( + private http: Http, + private formBuilder: FormBuilder, + private api: ApiService + ) { + this.api.getAgeRanges() + .subscribe( + result => { + console.log(result); + this.ageRanges = result.ages; + } + ); + this.signin = this.formBuilder.group({ + email: ['', [Validators.required]], + password: ['', [Validators.required]], + }); + } + + onSubmit() { + console.log(this.signin.value); + + this.peopleService + .register(this.signin.value) + .subscribe( + result => { + console.log( logged in! ); + }, + error => { + console.log( error._body ); + } + ); + } - constructor() { } -} +} \ No newline at end of file diff --git a/src/app/pages/register.component.html b/src/app/pages/register.component.html index 7b7dfe6..39f5c76 100644 --- a/src/app/pages/register.component.html +++ b/src/app/pages/register.component.html @@ -9,27 +9,27 @@

Create your account

- +
- +
- +
@ - +
- +
@@ -41,12 +41,12 @@
- +
- +
diff --git a/src/app/pages/register.component.ts b/src/app/pages/register.component.ts index aa82935..1a6ad91 100644 --- a/src/app/pages/register.component.ts +++ b/src/app/pages/register.component.ts @@ -37,6 +37,17 @@ export class RegisterComponent { onSubmit() { console.log(this.signup.value); + + this.peopleService + .register(this.signup.value) + .subscribe( + result => { + console.log( registered! ); + }, + error => { + console.log( error._body ); + } + ); }