This commit is contained in:
2023-05-05 12:10:17 +02:00
parent 72ae5f9bbc
commit 9c44077b71
3 changed files with 24 additions and 7 deletions

View File

@@ -1,16 +1,16 @@
import {Component, OnInit} from '@angular/core';
import {CookieService} from "ngx-cookie-service";
import {Router} from "@angular/router";
import {homeTranslations, listTranslations, managementTranslations} from "./interface/translations";
import {TranslateService} from "./service/language/translate.service";
import {ReadTranslateJsonService} from "./service/language/readTranslateJson.service";
import {cookieService} from "./service/cookie.service";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
export class AppComponent implements OnInit {
title = 'm-152';
homeTranslations: homeTranslations = {} as homeTranslations;
@@ -19,7 +19,7 @@ export class AppComponent implements OnInit{
constructor(
private cookieService: CookieService,
private cookieService: cookieService,
private router: Router,
private translateService: TranslateService,
private readTranslationJsonService: ReadTranslateJsonService,
@@ -33,10 +33,7 @@ export class AppComponent implements OnInit{
}
clearAllCookies() {
const allCookies = this.cookieService.getAll();
for (const cookieName in allCookies) {
this.cookieService.delete(cookieName);
}
this.cookieService.deleteUsername();
this.router.navigate(['/login']);
}

View File

@@ -5,6 +5,7 @@
<th>{{ translations.username }}</th>
<th>{{translations.password}}</th>
<th>admin</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -13,6 +14,7 @@
<td>{{ user.password }}</td>
<td *ngIf="user.admin==false">No</td>
<td *ngIf="user.admin==true">Yes</td>
<td> </td>
</tr>
</tbody>
</table>

View File

@@ -97,6 +97,24 @@ export class ManagementComponent implements OnInit {
this.showWaypointForm = false;
}
deleteLocation(id: number) {
this.locationService.deleteLocation(id).subscribe(location => {
this.locations?.splice(this.locations?.indexOf(location), 1);
});
}
deleteWaypoint(id: number) {
this.waypointService.deleteWaypoint(id).subscribe(waypoint => {
this.waypoints?.splice(this.waypoints?.indexOf(waypoint), 1);
});
}
deleteUser(id: number) {
this.userService.deleteUser(id).subscribe(user => {
this.users?.splice(this.users?.indexOf(user), 1);
});
}
openUserForm() {
this.showUserForm = true;
}