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

View File

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

View File

@@ -97,6 +97,24 @@ export class ManagementComponent implements OnInit {
this.showWaypointForm = false; 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() { openUserForm() {
this.showUserForm = true; this.showUserForm = true;
} }