Linter error fixes for feedback component

This commit is contained in:
Tom Bloor 2017-09-19 14:59:19 +01:00
parent 921b25718d
commit 662d6be5c9

View file

@ -7,18 +7,18 @@ import 'rxjs/add/operator/map';
@Component({ @Component({
templateUrl: 'feedback.component.html', templateUrl: 'feedback.component.html',
}) })
export class FeedbackComponent { export class FeedbackComponent implements OnInit {
feedbackForm: FormGroup; feedbackForm: FormGroup;
loggedInEmail: string; loggedInEmail: string;
noEmail: boolean = false; noEmail = false;
username: any; username: any;
feedbackFormStatus: any; feedbackFormStatus: any;
feedbackFormStatusError: string = 'Error received, please try again.'; feedbackFormStatusError = 'Error received, please try again.';
constructor( constructor(
private http: Http, private http: Http,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private api: ApiService, private api: ApiService,
) { ) {
this.feedbackForm = this.formBuilder.group({ this.feedbackForm = this.formBuilder.group({
email: ['', [Validators.required]], email: ['', [Validators.required]],
@ -28,7 +28,7 @@ export class FeedbackComponent {
ngOnInit(): void { ngOnInit(): void {
if(localStorage.getItem('email')) { if (localStorage.getItem('email')) {
this.loggedInEmail = localStorage.getItem('email'); this.loggedInEmail = localStorage.getItem('email');
} }
console.log('loggedInEmail: ' + this.loggedInEmail); console.log('loggedInEmail: ' + this.loggedInEmail);
@ -55,10 +55,10 @@ export class FeedbackComponent {
.feedback(this.feedbackForm.value) .feedback(this.feedbackForm.value)
.subscribe( .subscribe(
result => { result => {
if ( result.success == true ) { if ( result.success === true ) {
console.log('Successful Upload'); console.log('Successful Upload');
console.log(result); console.log(result);
this.feedbackFormStatus = "success"; this.feedbackFormStatus = 'success';
console.log(this.feedbackFormStatus); console.log(this.feedbackFormStatus);
this.feedbackForm.patchValue({ this.feedbackForm.patchValue({
feedbacktext: '', feedbacktext: '',
@ -66,7 +66,7 @@ export class FeedbackComponent {
} else { } else {
console.log('Upload Error'); console.log('Upload Error');
this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message); this.feedbackFormStatusError = JSON.stringify(result.status) + 'Error, ' + JSON.stringify(result.message);
this.feedbackFormStatus = "send_failed"; this.feedbackFormStatus = 'send_failed';
console.log(this.feedbackFormStatus); console.log(this.feedbackFormStatus);
} }
}, },
@ -75,13 +75,13 @@ export class FeedbackComponent {
console.log(error); console.log(error);
try { try {
console.log(error.error); console.log(error.error);
let jsonError = error.json(); const jsonError = error.json();
console.log("boop"); console.log('boop');
this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message; this.feedbackFormStatusError = '"' + jsonError.error + '" Error, ' + jsonError.message;
} catch(e) { } catch (e) {
this.feedbackFormStatusError = 'There was a server error, please try again later.'; this.feedbackFormStatusError = 'There was a server error, please try again later.';
} }
this.feedbackFormStatus = "send_failed"; this.feedbackFormStatus = 'send_failed';
console.log(this.feedbackFormStatus); console.log(this.feedbackFormStatus);
} }
); );