From 5ce7e17c8b7f03412323879cffc5a31f45d08208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joe=20Ku=CC=88ng?= Date: Mon, 1 May 2023 15:59:17 +0200 Subject: [PATCH] changes --- .../management/management.component.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/component/management/management.component.ts b/src/app/component/management/management.component.ts index 048c2f3..e63162e 100644 --- a/src/app/component/management/management.component.ts +++ b/src/app/component/management/management.component.ts @@ -6,7 +6,6 @@ import {ActivatedRoute} from "@angular/router"; import {LocationService} from "../../service/http/location.service"; import {UserService} from "../../service/http/user.service"; import {WaypointService} from "../../service/http/waypoint.service"; -import {toNumbers} from "@angular/compiler-cli/src/version_helpers"; @Component({ selector: 'app-home', @@ -20,13 +19,13 @@ export class ManagementComponent implements OnInit { showWaypointForm: boolean = false; newUser: UserEntity = {name: "", password: "", username: ""}; - newLocation: LocationEntity = {lat: 0, location: "", lon: 0, region: ""}; + newLocation: LocationEntity = {location: "", lat: 0, lon: 0, region: ""}; newWaypoint: WaypointsEntity = {description: "", img: "", lat: 0, locationName: "", lon: 0, name: ""}; locations: LocationEntity[] | undefined; waypoints: WaypointsEntity[] | undefined; users: UserEntity[] | undefined; - + protected readonly String = String; constructor( private route: ActivatedRoute, @@ -49,7 +48,7 @@ export class ManagementComponent implements OnInit { } addUser(name: string, username: string, password: string) { - this.newUser = { name: name, username: username, password: password}; + this.newUser = {name: name, username: username, password: password}; this.userService.createUser(this.newUser).subscribe(user => { this.users?.push(user); }); @@ -58,6 +57,8 @@ export class ManagementComponent implements OnInit { addLocation(name: string, region: string, lat: number, lon: number) { this.newLocation = {location: name, region: region, lat: lat, lon: lon}; + console.log("newLocation") + console.log(this.newLocation); this.locationService.createLocation(this.newLocation).subscribe(location => { this.locations?.push(location); }); @@ -65,7 +66,14 @@ export class ManagementComponent implements OnInit { } addWaypoint(name: string, lat: number, lon: number, description: string, image: string, locationName: string) { - this.newWaypoint = {description: description, img: image, lat: lat, locationName: locationName, lon: lon, name: name} + this.newWaypoint = { + description: description, + img: image, + lat: lat, + locationName: locationName, + lon: lon, + name: name + } this.waypointService.createWaypoint(this.newWaypoint).subscribe(waypoint => { this.waypoints?.push(waypoint); }); @@ -95,6 +103,4 @@ export class ManagementComponent implements OnInit { closeWaypointForm() { this.showWaypointForm = false; } - - protected readonly String = String; }