Fix linter errors on account-edit

This commit is contained in:
Tom Bloor 2017-08-24 16:20:55 +01:00
parent 346ea2c6fd
commit c46e91e795

View file

@ -8,7 +8,7 @@ import 'rxjs/add/operator/map';
templateUrl: 'account-edit.component.html', templateUrl: 'account-edit.component.html',
providers: [ApiService] providers: [ApiService]
}) })
export class AccountEditComponent { export class AccountEditComponent implements OnInit {
settingForm: FormGroup; settingForm: FormGroup;
settingOrganisationForm: FormGroup; settingOrganisationForm: FormGroup;
settingCustomerForm: FormGroup; settingCustomerForm: FormGroup;
@ -69,23 +69,23 @@ export class AccountEditComponent {
onSubmitOrganisation() { onSubmitOrganisation() {
console.log(this.settingForm.valid); console.log(this.settingForm.valid);
if (!this.settingForm.valid && !this.settingOrganisationForm.valid) { if (!this.settingForm.valid && !this.settingOrganisationForm.valid) {
console.log("Not Valid!"); console.log('Not Valid!');
return; return;
} }
let settingForm = this.settingForm.value; const settingForm = this.settingForm.value;
let settingOrganisationForm = this.settingOrganisationForm.value; const settingOrganisationForm = this.settingOrganisationForm.value;
// image upload code // image upload code
let fi = this.fileInput.nativeElement; const fi = this.fileInput.nativeElement;
let data = new FormData(); const data = new FormData();
if (fi.files && fi.files[0]) { if (fi.files && fi.files[0]) {
let fileToUpload = fi.files[0]; const fileToUpload = fi.files[0];
data.append("file", fileToUpload); data.append('file', fileToUpload);
} }
let submitData = { const submitData = {
email: settingForm.email, email: settingForm.email,
postcode: settingForm.postcode, postcode: settingForm.postcode,
password: settingForm.password, password: settingForm.password,
@ -93,7 +93,7 @@ export class AccountEditComponent {
name: settingOrganisationForm.name, name: settingOrganisationForm.name,
street_name: settingOrganisationForm.street_name, street_name: settingOrganisationForm.street_name,
town: settingOrganisationForm.town, town: settingOrganisationForm.town,
} };
data.append('form', JSON.stringify(submitData)); data.append('form', JSON.stringify(submitData));
@ -113,30 +113,30 @@ export class AccountEditComponent {
onSubmitCustomer() { onSubmitCustomer() {
console.log(this.settingForm.valid); console.log(this.settingForm.valid);
if (!this.settingForm.valid && !this.settingCustomerForm.valid) { if (!this.settingForm.valid && !this.settingCustomerForm.valid) {
console.log("Not Valid!"); console.log('Not Valid!');
return; return;
} }
let settingForm = this.settingForm.value; const settingForm = this.settingForm.value;
let settingCustomerForm = this.settingCustomerForm.value; const settingCustomerForm = this.settingCustomerForm.value;
// image upload code // image upload code
let fi = this.fileInput.nativeElement; const fi = this.fileInput.nativeElement;
let data = new FormData(); const data = new FormData();
if (fi.files && fi.files[0]) { if (fi.files && fi.files[0]) {
let fileToUpload = fi.files[0]; const fileToUpload = fi.files[0];
data.append("file", fileToUpload); data.append('file', fileToUpload);
} }
let submitData = { const submitData = {
email: settingForm.email, email: settingForm.email,
postcode: settingForm.postcode, postcode: settingForm.postcode,
password: settingForm.password, password: settingForm.password,
new_password: settingForm.new_password, new_password: settingForm.new_password,
full_name: settingCustomerForm.full_name, full_name: settingCustomerForm.full_name,
display_name: settingCustomerForm.display_name, display_name: settingCustomerForm.display_name,
} };
data.append('form', JSON.stringify(submitData)); data.append('form', JSON.stringify(submitData));