fix management component

This commit is contained in:
2023-05-05 08:37:07 +02:00
parent a5ad7ce97d
commit 3a87d41068
2 changed files with 4 additions and 9 deletions

View File

@@ -20,7 +20,6 @@
</thead>
<tbody>
<tr *ngFor="let user of users">
<td>{{ user.name }}</td>
<td>{{ user.username }}</td>
<td>{{ user.password }}</td>
</tr>
@@ -37,11 +36,7 @@
<div class="overlay" [style.display]="showUserForm ? 'block' : 'none'">
<div class="form-container">
<h2>{{translations.addUserButton}}</h2>
<form (submit)="addUser(newUser.name, newUser.username, newUser.password)">
<div>
<label for="name">{{translations.name}}:</label>
<input type="text" id="name" name="name" [(ngModel)]="newUser.name">
</div>
<form (submit)="addUser(newUser.username, newUser.password)">
<div>
<label for="username">{{translations.username}}:</label>
<input type="text" id="username" name="username" [(ngModel)]="newUser.username">

View File

@@ -24,7 +24,7 @@ export class ManagementComponent implements OnInit {
showLocationForm: boolean = false;
showWaypointForm: boolean = false;
newUser: UserEntity = {name: "", password: "", username: ""};
newUser: UserEntity = { password: "", username: ""};
newLocation: LocationEntity = {location: "", lat: 0, lon: 0, region: ""};
newWaypoint: WaypointsEntity = {description: "", img: "", lat: 0, locationName: "", lon: 0, name: ""};
@@ -59,8 +59,8 @@ export class ManagementComponent implements OnInit {
});
}
addUser(name: string, username: string, password: string) {
this.newUser = {name: name, username: username, password: password};
addUser( username: string, password: string) {
this.newUser = { username: username, password: password};
this.userService.createUser(this.newUser).subscribe(user => {
this.users?.push(user);
});