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

File:
1 edited

Legend:

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

    rbdd6491 rb738035  
    9393
    9494    this.ref.onClose.subscribe((planner: Planner) => {
    95       if(planner){
    96       this.plannerLocationDto.locationId = location.id;
    97       this.plannerLocationDto.plannerId = planner.id;
    98       console.log("LOC ID: " + this.plannerLocationDto.locationId);
    99       console.log("PLANNER ID: " + this.plannerLocationDto.plannerId);
     95      if (planner) {
     96        this.plannerLocationDto.locationId = location.id;
     97        this.plannerLocationDto.plannerId = planner.id;
     98        console.log("LOC ID: " + this.plannerLocationDto.locationId);
     99        console.log("PLANNER ID: " + this.plannerLocationDto.plannerId);
    100100
    101       this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe(
    102         lid => {
    103           if (lid.length == 0) {
    104             this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
    105               data => {
    106                 console.log(data);
    107               }
    108             );
    109             this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name });
    110 
    111           } else if (lid.length > 0) {
    112             if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) {
    113               console.log("LOKACIJATA VEKE JA IMA VO PLANEROT");
    114               this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' });
    115             } else {
     101        this.locationService.getAllLocationIdsForPlanner(planner.id).subscribe(
     102          lid => {
     103            if (lid.length == 0) {
    116104              this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
    117105                data => {
     
    120108              );
    121109              this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name });
     110
     111            } else if (lid.length > 0) {
     112              if (lid.indexOf(this.plannerLocationDto.locationId) !== -1) {
     113                console.log("LOKACIJATA VEKE JA IMA VO PLANEROT");
     114                this.messageService.add({ severity: 'error', summary: 'Location ' + location.name + ' already exists in the planner.' });
     115              } else {
     116                this.locationService.postLocationToPlanner(this.plannerLocationDto).subscribe(
     117                  data => {
     118                    console.log(data);
     119                  }
     120                );
     121                this.messageService.add({ severity: 'success', summary: 'Location ' + location.name + ' has been added to planner: ', detail: planner.name });
     122              }
     123
    122124            }
    123 
    124125          }
    125         }
    126       );
     126        );
    127127      }
    128128    });
    129  
     129
    130130  }
    131131
Note: See TracChangeset for help on using the changeset viewer.