Fix indentation on login component
This commit is contained in:
parent
ee7b81ad3c
commit
59693df214
1 changed files with 31 additions and 31 deletions
|
@ -14,50 +14,50 @@ export class LoginComponent implements OnInit {
|
||||||
returnUrl: string;
|
returnUrl: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private http: Http,
|
private http: Http,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private api: ApiService
|
private api: ApiService
|
||||||
) {
|
) {
|
||||||
this.signin = this.formBuilder.group({
|
this.signin = this.formBuilder.group({
|
||||||
email: ['', [Validators.required]],
|
email: ['', [Validators.required]],
|
||||||
password: ['', [Validators.required]],
|
password: ['', [Validators.required]],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
// reset login status
|
// reset login status
|
||||||
this.api
|
this.api
|
||||||
.logout()
|
.logout()
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('Logged out!');
|
console.log('Logged out!');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this.api.graph_data(undefined).subscribe(
|
this.api.graph_data(undefined).subscribe(
|
||||||
result => { console.log(result) }
|
result => { console.log(result) }
|
||||||
)
|
)
|
||||||
|
|
||||||
// get return url from route parameters or default to '/'
|
// get return url from route parameters or default to '/'
|
||||||
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
console.log(this.signin.value);
|
console.log(this.signin.value);
|
||||||
|
|
||||||
this.api
|
this.api
|
||||||
.login(this.signin.value)
|
.login(this.signin.value)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
result => {
|
result => {
|
||||||
console.log('logged in!');
|
console.log('logged in!');
|
||||||
this.router.navigate([this.returnUrl]);
|
this.router.navigate([this.returnUrl]);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log( error._body );
|
console.log( error._body );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue