Ignore:
Timestamp:
01/24/22 21:08:32 (2 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
76712b2
Parents:
bdd6491
Message:

signup/login server errors on front and remove location from planner

Location:
trip-planner-front/src/app/_services
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/_services/location.service.ts

    rbdd6491 rb738035  
    2323    postLocationToPlanner(plannerLocationDto : PlannerLocationDto) : Observable<Location>{
    2424        let url = "http://localhost:8080/api/add-location";
    25         return this.httpClient.put<Location>(url, plannerLocationDto);
     25        return this.httpClient.post<Location>(url, plannerLocationDto);
    2626    }
    2727
  • trip-planner-front/src/app/_services/planner.service.ts

    rbdd6491 rb738035  
    33import { Observable } from "rxjs";
    44import { PlannerDto } from "../_models/dto/plannerDto";
     5import { PlannerLocationDto } from "../_models/dto/plannerLocationDto";
    56import { Planner } from "../_models/planner";
    67
     
    1516        'Content-Type': 'application/json'
    1617    });
    17 
    1818
    1919    constructor(private httpClient: HttpClient) {
     
    3030    postInitialPlanner(plannerDto: PlannerDto): Observable<Planner> {
    3131        let url = "http://localhost:8080/api/planner/new";
    32         return this.httpClient.post<Planner>(url, plannerDto);
     32        return this.httpClient.post<Planner>(url, plannerDto, {headers: this.httpHeaders});
    3333    }
    3434
     
    4747        return this.httpClient.delete<Planner>(url, { headers: this.httpHeaders });
    4848    }
     49
     50    deleteLocationFromPlanner(plannerLocationDto : PlannerLocationDto) {
     51        let url = "http://localhost:8080/api/delete-location";
     52        const options = {
     53            body: {
     54                "plannerId": plannerLocationDto.plannerId,
     55                "locationId": plannerLocationDto.locationId
     56            }
     57        }
     58        return this.httpClient.request('delete', url, options);
     59    }
     60 
     61
    4962}
  • trip-planner-front/src/app/_services/user.service.ts

    rbdd6491 rb738035  
    4343    let user = sessionStorage.getItem("username");
    4444    let token = sessionStorage.getItem("token");
    45     console.log(user);
    46     console.log(token);
    47     console.log(!(user === null));
    4845    return !(user === null);
    4946  }
    5047
     48  getAllUsernames() {
     49    let url = "http://localhost:8080/api/users/usernames";
     50    return this.httpClient.get<string[]>(url);
     51  }
     52
     53  getPassword(loginRequest : LoginRequest){
     54    let url="http://localhost:8080/api/users/password";
     55    const options = {
     56     
     57      body: {
     58          "username": loginRequest.username
     59         
     60      }
     61  }
     62    return this.httpClient.request('get', url, options);
     63  }
     64
    5165}
Note: See TracChangeset for help on using the changeset viewer.