From 5a2cd0e3a0e20d6d2bb704be824faf9fbf40d26b Mon Sep 17 00:00:00 2001 From: tito Date: Sat, 6 May 2023 16:50:23 +0200 Subject: [PATCH] fix errore user.id can be undefined --- src/app/component/detail/detail.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/component/detail/detail.component.ts b/src/app/component/detail/detail.component.ts index a245695..2735e5a 100755 --- a/src/app/component/detail/detail.component.ts +++ b/src/app/component/detail/detail.component.ts @@ -94,9 +94,9 @@ export class DetailComponent implements OnInit { // implement this nex line in angular ts this.myModal.nativeElement.checked = true; this.userService.getUser("tito").subscribe(user => { - if (user.id !== undefined) { - let waypointVisited: WaypointsVisitedEntity = {userId: user.id , waypointId: this.waypointInfo.id} - console.log("waypointVisited", waypointVisited) + if (user?.id !== undefined) { + let waypointVisited: WaypointsVisitedEntity = {userId: user.id , waypointId: this.waypointInfo.id} + console.log("waypointVisited", waypointVisited) this.waypointVisitedService.createWaypoint(waypointVisited) } })