Clear up Feedback component
This commit is contained in:
parent
c1b50752da
commit
b4bcdf0149
2 changed files with 10 additions and 15 deletions
|
@ -11,7 +11,7 @@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-md-3 form-control-label" for="text-input"><strong>Email</strong></label>
|
<label class="col-md-3 form-control-label" for="text-input"><strong>Email</strong></label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input type="text" class="form-control" name="email" formControlName="email" placeholder="Enter Account Email Here" [(ngModel)]="loggedInEmail" [disabled]="noEmail">
|
<input type="text" class="form-control" name="email" formControlName="email" placeholder="Enter Account Email Here">
|
||||||
<span class="help-block">Enter your email here if it doesn't show.</span>
|
<span class="help-block">Enter your email here if it doesn't show.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
import { ApiService } from '../providers/api-service';
|
import { ApiService } from '../providers/api-service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'feedback.component.html',
|
templateUrl: 'feedback.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
export class FeedbackComponent implements OnInit {
|
export class FeedbackComponent implements OnInit {
|
||||||
feedbackForm: FormGroup;
|
feedbackForm: FormGroup;
|
||||||
loggedInEmail: string;
|
loggedInEmail: string;
|
||||||
|
@ -14,23 +14,19 @@ export class FeedbackComponent implements OnInit {
|
||||||
feedbackFormStatus: any;
|
feedbackFormStatus: any;
|
||||||
feedbackFormStatusError = 'Error received, please try again.';
|
feedbackFormStatusError = 'Error received, please try again.';
|
||||||
|
|
||||||
constructor(
|
constructor(private api: ApiService) {
|
||||||
private formBuilder: FormBuilder,
|
this.feedbackForm = new FormGroup({
|
||||||
private api: ApiService,
|
email: new FormControl({value: this.loggedInEmail, disabled: this.noEmail}, Validators.required),
|
||||||
) {
|
feedbacktext: new FormControl('', Validators.required),
|
||||||
this.feedbackForm = this.formBuilder.group({
|
|
||||||
email: ['', [Validators.required]],
|
|
||||||
feedbacktext: ['', [Validators.required]],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
if (this.loggedInEmail) {
|
if (!this.loggedInEmail) {
|
||||||
console.log('email not found in storage');
|
console.log('email not found in storage');
|
||||||
this.api.accountFullLoad().subscribe(
|
this.api.accountFullLoad().subscribe(
|
||||||
result => {
|
result => {
|
||||||
|
@ -48,7 +44,7 @@ export class FeedbackComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit(): void {
|
||||||
this.api
|
this.api
|
||||||
.feedback(this.feedbackForm.value)
|
.feedback(this.feedbackForm.value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
@ -76,5 +72,4 @@ export class FeedbackComponent implements OnInit {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue