Finished Feedback form code to working and added routing
This commit is contained in:
parent
506e3b36da
commit
95653e2a11
6 changed files with 28 additions and 31 deletions
|
@ -5,13 +5,13 @@ import { ApiService } from '../providers/api-service';
|
|||
import 'rxjs/add/operator/map';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'add-data.component.html',
|
||||
templateUrl: 'feedback.component.html',
|
||||
providers: [ApiService]
|
||||
})
|
||||
export class FeedbackPage {
|
||||
export class FeedbackComponent {
|
||||
feedbackForm: FormGroup;
|
||||
loggedIn: boolean;
|
||||
loggedInEmail: any;
|
||||
noEmail: boolean = false;
|
||||
username: any;
|
||||
feedbackFormStatus: any;
|
||||
feedbackFormStatusError: string = 'Error received, please try again.';
|
||||
|
@ -21,7 +21,10 @@ export class FeedbackPage {
|
|||
private formBuilder: FormBuilder,
|
||||
private api: ApiService,
|
||||
) {
|
||||
this.getUserEmail();
|
||||
this.loggedInEmail = localStorage.getItem('email');
|
||||
if (this.loggedInEmail == null) {
|
||||
this.noEmail = true;
|
||||
}
|
||||
|
||||
this.feedbackForm = this.formBuilder.group({
|
||||
email: ['', [Validators.required]],
|
||||
|
@ -66,23 +69,4 @@ export class FeedbackPage {
|
|||
);
|
||||
}
|
||||
|
||||
getUserEmail() {
|
||||
this.api.getEmail().subscribe(
|
||||
result => {
|
||||
if (result) {
|
||||
console.log('Email has been received');
|
||||
this.loggedInEmail = result;
|
||||
this.loggedIn = true;
|
||||
} else {
|
||||
console.log('Email is not available');
|
||||
this.loggedIn = false;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log('Email could not be received');
|
||||
this.loggedIn = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue