fix waypointVisited

This commit is contained in:
2023-05-03 15:04:39 +02:00
parent 90a8ed0719
commit f7d6d19b5b

View File

@@ -1,12 +1,11 @@
import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {catchError, Observable} from "rxjs";
import {LocationEntity} from "../../interface/LocationEntity";
import {WaypointsEntity} from "../../interface/WaypointsEntity";
import {WaypointsVisitedEntity} from "../../interface/WaypointsVisitedEntity";
const BASE_URL = "progetto152";
const WAYPOINT_VISITED = BASE_URL + "/waypoint/visited/";
const GET_WAYPOINT_BY_USER = WAYPOINT_VISITED + "USER/";
const WAYPOINT_VISITED = BASE_URL + "/waypoint/visited";
const GET_WAYPOINT_BY_USER = WAYPOINT_VISITED + "/USER/";
@Injectable({
@@ -20,26 +19,26 @@ export class WaypointVisitedService {
}
getWaypoints() {
return this.http.get<WaypointsEntity[]>(WAYPOINT_VISITED);
return this.http.get<WaypointsVisitedEntity[]>(WAYPOINT_VISITED);
}
getwaypointVisited(id: number) {
return this.http.get<WaypointsEntity>(WAYPOINT_VISITED + id);
return this.http.get<WaypointsVisitedEntity>(WAYPOINT_VISITED +"/"+ id);
}
getWaypointByUser(user: string) {
return this.http.get<WaypointsEntity[]>(GET_WAYPOINT_BY_USER + user);
return this.http.get<WaypointsVisitedEntity[]>(GET_WAYPOINT_BY_USER + user);
}
createWaypoint(waypoint: WaypointsEntity) {
return this.http.post<WaypointsEntity>(WAYPOINT_VISITED, waypoint);
createWaypoint(waypointvisited: WaypointsVisitedEntity) {
return this.http.post<WaypointsEntity>(WAYPOINT_VISITED, waypointvisited);
}
updateWaypoint(waypoint: WaypointsEntity, id: number) {
return this.http.put<WaypointsEntity>(WAYPOINT_VISITED + id, waypoint);
updateWaypoint(waypoint: WaypointsVisitedEntity, id: number) {
return this.http.put<WaypointsVisitedEntity>(WAYPOINT_VISITED +"/"+ id, waypoint);
}
deleteWaypoint(id: number) {
return this.http.delete<WaypointsEntity>(WAYPOINT_VISITED + id);
return this.http.delete<WaypointsVisitedEntity>(WAYPOINT_VISITED + id);
}
}