Ignore:
Timestamp:
01/24/22 21:08:32 (3 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/planner/edit-planner
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trip-planner-front/src/app/planner/edit-planner/edit-planner.component.html

    rbdd6491 rb738035  
    3838                                </td>
    3939                                <td>
    40                                     <button pButton pRipple type="button" icon="pi pi-times" class="p-button-rounded p-button-danger p-button-text"></button>
     40                                    <button pButton pRipple type="button" icon="pi pi-times" class="p-button-rounded p-button-danger p-button-text" (click)="onClickRemoveLocation(planner, location)"></button>
    4141                                </td>
    4242                            </tr>
  • trip-planner-front/src/app/planner/edit-planner/edit-planner.component.ts

    rbdd6491 rb738035  
    33import { ActivatedRoute, Router } from '@angular/router';
    44import { PlannerDto } from 'src/app/_models/dto/plannerDto';
     5import { PlannerLocationDto } from 'src/app/_models/dto/plannerLocationDto';
    56import { Location } from 'src/app/_models/location';
    67import { Planner } from 'src/app/_models/planner';
     
    2122  id: number;
    2223  locations: Location[];
    23 
     24  plannerLocationDto: PlannerLocationDto;
    2425
    2526  constructor(private router: Router, private route: ActivatedRoute, private fb: FormBuilder, private plannerService: PlannerService,
     
    3334    this.id = 1;
    3435    this.locations = [];
     36    this.plannerLocationDto = new PlannerLocationDto();
    3537  }
    3638
     
    6466  }
    6567
    66   private updatePlanner() {
     68  updatePlanner() {
    6769    this.plannerService.updatePlanner(this.id, this.form.value)
    6870      .pipe()
     
    8183  }
    8284
    83   onClickRemoveLocation(id : number){
    84    
     85  onClickRemoveLocation(planner: Planner, location: Location) {
     86    planner.id = this.id;
     87
     88    this.plannerLocationDto.plannerId = planner.id;
     89    this.plannerLocationDto.locationId = location.id;
     90    console.log(this.plannerLocationDto.plannerId);
     91    console.log(this.plannerLocationDto.locationId);
     92    this.plannerService.deleteLocationFromPlanner(this.plannerLocationDto).subscribe(
     93      data => {
     94        console.log("deleted")
     95      }
     96    );
     97    window.location.reload();
    8598  }
    8699}
Note: See TracChangeset for help on using the changeset viewer.