This commit is contained in:
2023-05-05 11:37:52 +02:00
parent d072dca42c
commit b7aca11a38
3 changed files with 11 additions and 4 deletions

View File

@@ -38,4 +38,6 @@
</div> </div>
<div class="radial-progress text-primary" style="--value:70; --size:12rem; --thickness: 1.5rem;"><span style="font-size: 20pt">70%</span></div>
</div> </div>

View File

@@ -46,7 +46,7 @@ export class LoginComponent implements OnInit {
this.newUser.password = createUser.password; this.newUser.password = createUser.password;
this.userService.createUser(this.newUser).subscribe(user => { this.userService.createUser(this.newUser).subscribe(user => {
this.cookieService.setUsername(createUser.username); this.cookieService.setUsername(createUser.username);
this.router.navigate(['/management']); this.router.navigate(['/home']);
}); });
}); });
} }
@@ -55,7 +55,7 @@ export class LoginComponent implements OnInit {
this.userService.getUser(username).subscribe(user => { this.userService.getUser(username).subscribe(user => {
if (user.password == password) { if (user.password == password) {
this.cookieService.setUsername(username); this.cookieService.setUsername(username);
this.router.navigate(['/management']); this.router.navigate(['/home']);
} else { } else {
this.errorLogin = true; this.errorLogin = true;
} }

View File

@@ -2,7 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {UserEntity} from "../../interface/UserEntity"; import {UserEntity} from "../../interface/UserEntity";
import {LocationEntity} from "../../interface/LocationEntity"; import {LocationEntity} from "../../interface/LocationEntity";
import {WaypointsEntity} from "../../interface/WaypointsEntity"; import {WaypointsEntity} from "../../interface/WaypointsEntity";
import {ActivatedRoute} from "@angular/router"; import {Router} from "@angular/router";
import {LocationService} from "../../service/http/location.service"; import {LocationService} from "../../service/http/location.service";
import {UserService} from "../../service/http/user.service"; import {UserService} from "../../service/http/user.service";
import {WaypointService} from "../../service/http/waypoint.service"; import {WaypointService} from "../../service/http/waypoint.service";
@@ -35,7 +35,7 @@ export class ManagementComponent implements OnInit {
translations: managementTranslations = {} as managementTranslations translations: managementTranslations = {} as managementTranslations
constructor( constructor(
private route: ActivatedRoute, private route: Router,
private locationService: LocationService, private locationService: LocationService,
private waypointService: WaypointService, private waypointService: WaypointService,
private userService: UserService, private userService: UserService,
@@ -48,6 +48,11 @@ export class ManagementComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.translations = this.readTranslationJsonService.getManagementTranslations(); this.translations = this.readTranslationJsonService.getManagementTranslations();
this.username = this.cookieService.getUsername(); this.username = this.cookieService.getUsername();
this.userService.getUser(this.username).subscribe(user => {
if (user.admin == false) {
this.route.navigate(['/home']);
}
});
this.locationService.getLocations().subscribe(locations => { this.locationService.getLocations().subscribe(locations => {
this.locations = locations; this.locations = locations;
}); });