partial fix login error message

This commit is contained in:
2023-05-06 13:16:01 +02:00
parent 1690e73e0b
commit 1175c00790
3 changed files with 36 additions and 7 deletions

View File

@@ -49,9 +49,15 @@ export class ManagementComponent implements OnInit {
this.translations = this.readTranslationJsonService.getManagementTranslations();
this.username = this.cookieService.getUsername();
this.userService.getUser(this.username).subscribe(user => {
if (user.admin == false) {
this.route.navigate(['/home']);
if (user !== null) {
if (user.admin == false) {
this.route.navigate(['/home']);
}
}else {
this.cookieService.deleteUsername();
this.route.navigate(['/login']);
}
});
this.locationService.getLocations().subscribe(locations => {
this.locations = locations;