From 014722c694e374422342083f7e6d6e6930b4c7a3 Mon Sep 17 00:00:00 2001 From: piratefinn Date: Thu, 15 Jun 2017 16:17:33 +0100 Subject: [PATCH] Fixed registration age submission --- src/app/pages/register.component.html | 6 +++--- src/app/pages/register.component.ts | 22 +++++++++++----------- src/app/providers/api-service.ts | 6 ------ 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/app/pages/register.component.html b/src/app/pages/register.component.html index d14d194..1369992 100644 --- a/src/app/pages/register.component.html +++ b/src/app/pages/register.component.html @@ -65,9 +65,9 @@
- Age Range - +
diff --git a/src/app/pages/register.component.ts b/src/app/pages/register.component.ts index 65e2e0b..f51f7eb 100644 --- a/src/app/pages/register.component.ts +++ b/src/app/pages/register.component.ts @@ -15,21 +15,21 @@ export class RegisterComponent { signupForm: ValidationManager; customerForm: ValidationManager; organisationForm: ValidationManager; - ageRanges: Object[]; + years: Object[]; constructor( private http: Http, private formBuilder: FormBuilder, private router: Router, private api: ApiService, - ) { - this.api.getAgeRanges() - .subscribe( - result => { - console.log(result); - this.ageRanges = result.ages; - } - ); + ) { + this.years = []; + let max = new Date().getFullYear() - 10, + min = max - 140; + + for (let i = max; i>=min; i--){ + this.years.push(i); + } this.signupForm = new ValidationManager({ token: 'required', usertype: 'required', @@ -41,7 +41,7 @@ export class RegisterComponent { display_name: 'required', full_name: 'required', postcode: 'required', - age_range: 'required', + year_of_birth: 'required', }); this.organisationForm = new ValidationManager({ name: 'required', @@ -69,7 +69,7 @@ export class RegisterComponent { display_name: customerForm.display_name, full_name: customerForm.full_name, postcode: customerForm.postcode, - age_range: customerForm.age_range, + year_of_birth:customerForm.year_of_birth, }; console.log(data); this.api diff --git a/src/app/providers/api-service.ts b/src/app/providers/api-service.ts index d4d2398..f668417 100644 --- a/src/app/providers/api-service.ts +++ b/src/app/providers/api-service.ts @@ -34,12 +34,6 @@ export class ApiService { localStorage.removeItem('sessionKey'); } - public getAgeRanges() { - return this.http.get( - this.apiUrl + '/info/ages' - ).map( res => res.json() ); - } - public register(data) { return this.http.post( this.apiUrl + '/register',