diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c8af843..2a98ed2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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']); } diff --git a/src/app/component/management/management.component.html b/src/app/component/management/management.component.html index 28a060a..4b927b8 100644 --- a/src/app/component/management/management.component.html +++ b/src/app/component/management/management.component.html @@ -5,6 +5,7 @@ {{ translations.username }} {{translations.password}} admin + @@ -13,6 +14,7 @@ {{ user.password }} No Yes + diff --git a/src/app/component/management/management.component.ts b/src/app/component/management/management.component.ts index 41e9322..1400946 100644 --- a/src/app/component/management/management.component.ts +++ b/src/app/component/management/management.component.ts @@ -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; }