diff --git a/src/app/service/http/location.service.ts b/src/app/service/http/location.service.ts index 398d4f4..5de754f 100644 --- a/src/app/service/http/location.service.ts +++ b/src/app/service/http/location.service.ts @@ -2,8 +2,8 @@ import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {LocationEntity} from "../../interface/LocationEntity"; -const BASE_URL = "localhost:8080/progetto152/"; -const LOCATION = BASE_URL + "location/"; +const BASE_URL = "progetto152"; +const LOCATION = BASE_URL + "/location"; @Injectable({ @@ -21,7 +21,7 @@ export class LocationService { } getLocation(location: string) { - return this.http.get(LOCATION + location); + return this.http.get(LOCATION + "/" + location); } createLocation(location: LocationEntity) { diff --git a/src/app/service/http/user.service.ts b/src/app/service/http/user.service.ts index c750706..7974fc9 100644 --- a/src/app/service/http/user.service.ts +++ b/src/app/service/http/user.service.ts @@ -2,16 +2,16 @@ import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {UserEntity} from "../../interface/UserEntity"; -const BASE_URL = "localhost:8080/progetto152/"; -const USER = BASE_URL + "user/"; -const GET_USER_BY_ID = USER + "id/"; +const BASE_URL = "progetto152"; +const USER = BASE_URL + "/user"; +const GET_USER_BY_ID = USER + "/id"; @Injectable({ providedIn: 'root', }) -export class LocationService { +export class UserService { constructor( private http: HttpClient, ) { @@ -22,11 +22,11 @@ export class LocationService { } getUser(username: string) { - return this.http.get(USER + username); + return this.http.get(USER + "/" + username); } getUserById(id: number) { - return this.http.get(GET_USER_BY_ID + id); + return this.http.get(GET_USER_BY_ID + "/" + id); } createUser(user: UserEntity) { diff --git a/src/app/service/http/waypoint.service.ts b/src/app/service/http/waypoint.service.ts index 8784c5d..f5f9d2e 100644 --- a/src/app/service/http/waypoint.service.ts +++ b/src/app/service/http/waypoint.service.ts @@ -1,9 +1,10 @@ import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {WaypointsEntity} from "../../interface/WaypointsEntity"; +import {catchError, throwError} from "rxjs"; -const BASE_URL = "localhost:8080/progetto152/"; -const WAYPOINT = BASE_URL + "waypoint/"; +const BASE_URL = "progetto152"; +const WAYPOINT = BASE_URL + "/waypoint"; const GET_WAYPOINT_BY_ID = WAYPOINT + "id/"; @@ -11,18 +12,19 @@ const GET_WAYPOINT_BY_ID = WAYPOINT + "id/"; providedIn: 'root', }) -export class LocationService { +export class WaypointService { constructor( private http: HttpClient, ) { } getWaypoints(location: string) { - return this.http.get(WAYPOINT + location); + return this.http.get(WAYPOINT + "/" + location) + } getWaypoint(location: string, id: number) { - return this.http.get(WAYPOINT + location + "/" + id); + return this.http.get(WAYPOINT + "/" + location + "/" + id); } getWaypointById(id: number) { @@ -34,7 +36,7 @@ export class LocationService { } updateWaypoint(waypoint: WaypointsEntity, id: number) { - return this.http.put(WAYPOINT + id, waypoint); + return this.http.put(WAYPOINT + "/" + id, waypoint); } deleteWaypoint(id: number) { diff --git a/src/app/service/http/waypointVisited.service.ts b/src/app/service/http/waypointVisited.service.ts index 3ec45ad..9e0bff7 100644 --- a/src/app/service/http/waypointVisited.service.ts +++ b/src/app/service/http/waypointVisited.service.ts @@ -4,8 +4,8 @@ import {catchError, Observable} from "rxjs"; import {LocationEntity} from "../../interface/LocationEntity"; import {WaypointsEntity} from "../../interface/WaypointsEntity"; -const BASE_URL = "localhost:8080/progetto152/"; -const WAYPOINT_VISITED = BASE_URL + "waypoint/visited/"; +const BASE_URL = "progetto152"; +const WAYPOINT_VISITED = BASE_URL + "/waypoint/visited/"; const GET_WAYPOINT_BY_USER = WAYPOINT_VISITED + "USER/"; @@ -13,7 +13,7 @@ const GET_WAYPOINT_BY_USER = WAYPOINT_VISITED + "USER/"; providedIn: 'root', }) -export class LocationService { +export class WaypointVisitedService { constructor( private http: HttpClient, ) {