fix linter errors on register component
This commit is contained in:
parent
dec53b4630
commit
61ac856cc2
1 changed files with 81 additions and 81 deletions
|
@ -1,6 +1,6 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ValidationManager } from "ng2-validation-manager";
|
||||
import { ValidationManager } from 'ng2-validation-manager';
|
||||
import { Http, Response } from '@angular/http';
|
||||
import { ApiService } from '../providers/api-service';
|
||||
import {Router } from '@angular/router';
|
||||
|
@ -16,7 +16,7 @@ export class RegisterComponent {
|
|||
organisationForm: ValidationManager;
|
||||
years: Object[];
|
||||
registerStatus: any;
|
||||
registerStatusError: string = 'Error received, please try again.';
|
||||
registerStatusError = 'Error received, please try again.';
|
||||
|
||||
constructor(
|
||||
private http: Http,
|
||||
|
@ -25,10 +25,10 @@ export class RegisterComponent {
|
|||
private api: ApiService,
|
||||
) {
|
||||
this.years = [];
|
||||
let max = new Date().getFullYear() - 10,
|
||||
const max = new Date().getFullYear() - 10,
|
||||
min = max - 140;
|
||||
|
||||
for (let i = max; i>=min; i--){
|
||||
for (let i = max; i >= min; i--) {
|
||||
this.years.push(i);
|
||||
}
|
||||
this.signupForm = new ValidationManager({
|
||||
|
@ -42,7 +42,7 @@ export class RegisterComponent {
|
|||
display_name: 'required',
|
||||
full_name: 'required',
|
||||
postcode: 'required',
|
||||
year_of_birth:'required',
|
||||
year_of_birth: 'required',
|
||||
});
|
||||
this.organisationForm = new ValidationManager({
|
||||
name: 'required',
|
||||
|
@ -57,15 +57,15 @@ export class RegisterComponent {
|
|||
|
||||
console.log(this.signupForm.isValid());
|
||||
if (!this.signupForm.isValid() && !this.customerForm.isValid()) {
|
||||
console.log("Not Valid!");
|
||||
this.registerStatus = "validation_failed";
|
||||
console.log('Not Valid!');
|
||||
this.registerStatus = 'validation_failed';
|
||||
console.log(this.registerStatus);
|
||||
return;
|
||||
}
|
||||
let signupForm = this.signupForm.getForm().value;
|
||||
let customerForm = this.customerForm.getForm().value;
|
||||
const signupForm = this.signupForm.getForm().value;
|
||||
const customerForm = this.customerForm.getForm().value;
|
||||
|
||||
let data = {
|
||||
const data = {
|
||||
token: signupForm.token,
|
||||
usertype: signupForm.usertype,
|
||||
email: signupForm.email,
|
||||
|
@ -73,7 +73,7 @@ export class RegisterComponent {
|
|||
display_name: customerForm.display_name,
|
||||
full_name: customerForm.full_name,
|
||||
postcode: customerForm.postcode,
|
||||
year_of_birth:customerForm.year_of_birth,
|
||||
year_of_birth: customerForm.year_of_birth,
|
||||
};
|
||||
console.log(data);
|
||||
this.api
|
||||
|
@ -81,7 +81,7 @@ export class RegisterComponent {
|
|||
.subscribe(
|
||||
result => {
|
||||
console.log('registered!');
|
||||
this.registerStatus = "success";
|
||||
this.registerStatus = 'success';
|
||||
console.log(this.registerStatus);
|
||||
this.router.navigate(['/dashboard']);
|
||||
},
|
||||
|
@ -90,13 +90,13 @@ export class RegisterComponent {
|
|||
console.log(error);
|
||||
try {
|
||||
console.log(error.error);
|
||||
let jsonError = error.json();
|
||||
console.log("boop");
|
||||
const jsonError = error.json();
|
||||
console.log('boop');
|
||||
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
this.registerStatusError = 'There was a server error, please try again later.';
|
||||
}
|
||||
this.registerStatus = "send_failed";
|
||||
this.registerStatus = 'send_failed';
|
||||
console.log(this.registerStatus);
|
||||
}
|
||||
);
|
||||
|
@ -105,15 +105,15 @@ export class RegisterComponent {
|
|||
|
||||
console.log(this.signupForm.isValid());
|
||||
if (!this.signupForm.isValid() || !this.organisationForm.isValid()) {
|
||||
console.log("Not Valid!");
|
||||
this.registerStatus = "validation_failed";
|
||||
console.log('Not Valid!');
|
||||
this.registerStatus = 'validation_failed';
|
||||
console.log(this.registerStatus);
|
||||
return;
|
||||
}
|
||||
let signupForm = this.signupForm.getForm().value;
|
||||
let organisationForm = this.organisationForm.getForm().value;
|
||||
const signupForm = this.signupForm.getForm().value;
|
||||
const organisationForm = this.organisationForm.getForm().value;
|
||||
|
||||
let data = {
|
||||
const data = {
|
||||
token: signupForm.token,
|
||||
usertype: signupForm.usertype,
|
||||
email: signupForm.email,
|
||||
|
@ -130,7 +130,7 @@ export class RegisterComponent {
|
|||
.subscribe(
|
||||
result => {
|
||||
console.log('registered!');
|
||||
this.registerStatus = "success";
|
||||
this.registerStatus = 'success';
|
||||
console.log(this.registerStatus);
|
||||
this.router.navigate(['/dashboard']);
|
||||
},
|
||||
|
@ -139,13 +139,13 @@ export class RegisterComponent {
|
|||
console.log(error);
|
||||
try {
|
||||
console.log(error.error);
|
||||
let jsonError = error.json();
|
||||
console.log("boop");
|
||||
const jsonError = error.json();
|
||||
console.log('boop');
|
||||
this.registerStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
this.registerStatusError = 'There was a server error, please try again later.';
|
||||
}
|
||||
this.registerStatus = "send_failed";
|
||||
this.registerStatus = 'send_failed';
|
||||
console.log(this.registerStatus);
|
||||
}
|
||||
);
|
||||
|
|
Reference in a new issue