reformat code

This commit is contained in:
Marco Zeisler 2021-03-21 18:44:30 +01:00
parent 374f18a8e7
commit 2518ed7239

View File

@ -16,26 +16,27 @@ export class LoginComponent implements OnInit {
errorMessage;
constructor(private http: HttpClient,
private activatedRoute: ActivatedRoute) { }
private activatedRoute: ActivatedRoute) {
}
ngOnInit(): void {
this.activatedRoute.fragment.subscribe(data => {
if (data) {
data.split('&').forEach(
element => {
const split = element.split('=');
if (split[0] === 'error') {
this.errorMessage = split[1];
return;
element => {
const split = element.split('=');
if (split[0] === 'error') {
this.errorMessage = split[1];
return;
}
if (split[0] === 'id_token') {
this.id_token = split[1];
this.parsedToken = JSON.parse(atob(this.id_token.split('.')[1]));
} else if (split[0] === 'state') {
this.state = split[1];
}
}
if (split[0] === 'id_token') {
this.id_token = split[1];
this.parsedToken = JSON.parse(atob(this.id_token.split('.')[1]));
} else if (split[0] === 'state') {
this.state = split[1];
}
}
);
);
}
});
}
@ -67,6 +68,6 @@ export class LoginComponent implements OnInit {
headers: new HttpHeaders(headerDict),
observe: 'response',
})
.subscribe(data => alert("Returned with code: "+data['status']));
.subscribe(data => alert('Returned with code: ' + data['status']));
}
}