Skip to content

Commit

Permalink
chore: cleanup and variable rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Kondziow committed Aug 26, 2024
1 parent 95346ca commit 11e59cc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
</button>
</li>

<li *ngIf="addingPointToRoute && addingPointToRouteId == mapLocationData.mapLocation.id"
<li *ngIf="addingPointToRoute && pointIdToBeAdded == mapLocationData.mapLocation.id"
class="list-group-item"
style="background-color: #c6c7d2;">
<app-route-list
[addingPointToRoute]=true
[addingPointToRouteId]="addingPointToRouteId"
[pointIdToBeAdded]="pointIdToBeAdded"
></app-route-list>
</li>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MapLocationListComponent implements OnInit, OnChanges {
userMode = false;

addingPointToRoute = false;
addingPointToRouteId: string;
pointIdToBeAdded: string;

constructor(private mapService: MapService,
private sidePanelService: SidePanelService,
Expand Down Expand Up @@ -225,7 +225,7 @@ export class MapLocationListComponent implements OnInit, OnChanges {
}

onAddToYourRoute(mapLocationId: string) {
this.addingPointToRouteId = mapLocationId;
this.pointIdToBeAdded = mapLocationId;
this.addingPointToRoute = !this.addingPointToRoute;
}
}
2 changes: 1 addition & 1 deletion src/app/route-map-location/route-map-location.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class RouteMapLocationService {
return this.http.post(url, newRouteMapLocation);
} else {
alert('This map Location is already in your route!')
return of(null); // Zwraca Observable z wartością `null`, gdy rekord już istnieje
return of(null);
}
})
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/route/route-list/route-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class RouteListComponent {
selectedRoute: Route;

@Input() addingPointToRoute: boolean = false;
@Input() addingPointToRouteId: string;
@Input() pointIdToBeAdded: string;

constructor(private routeService: RouteService, private mapLocationService: MapLocationService,
private mapService: MapService, private router: Router,
Expand Down Expand Up @@ -184,7 +184,7 @@ export class RouteListComponent {

addPointToRoute() {
if (confirm("You are about to add point to " + this.selectedRoute.name + " route.")) {
this.routeMapLocationService.postRouteMapLocation(this.selectedRoute.id, this.addingPointToRouteId)
this.routeMapLocationService.postRouteMapLocation(this.selectedRoute.id, this.pointIdToBeAdded)
.subscribe( response => {
this.router.navigate(['../list'], {relativeTo: this.activatedRoute})
});
Expand Down

0 comments on commit 11e59cc

Please sign in to comment.