Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/admin/admin.component.ts

    rdae4cde re0cdea2  
    5656  createHead() {
    5757    this.dataService.insertPharmacyHead(this.head)
    58         .subscribe((cHead) => {
     58        .subscribe((cHead: IPharmacyHead) => {
     59          if(cHead) {
    5960            this.heads.push(cHead);
    6061            this.openSnackBar("New head created!","OK");
     62          }
    6163        },
    6264        (err: any) => console.log(err),
     
    7779        },
    7880        (err: any) => console.log(err),
    79         () => {
    80           console.log("PharmacyHead deleted");
    81           location.reload();
    82         });
     81        () => console.log("PharmacyHead deleted"));
    8382  }
    8483
     
    8988    });
    9089    dialogRef.afterClosed().subscribe((editedHead: IPharmacyHead) => {
    91       if(editedHead) {
    92           console.log(editedHead);
    93           this.heads = this.heads.filter(x => x !== eHead);
    94           this.heads.push(editedHead);
    95           this.dataService.updatePharmacyHead(editedHead)
    96               .subscribe((hd: IPharmacyHead) => {
    97                   this.openSnackBar("Success! PharmacyHead edited", "OK").onAction().subscribe(() => {
    98                     location.reload();
    99                   });
    100               },
    101               (err: any) => console.log(err),
    102               () => console.log('PharmacyHead data updated'));
     90      if(editedHead){
     91        console.log(editedHead);
     92        this.heads = this.heads.filter(x => x !== eHead);
     93        this.heads.push(editedHead);
     94        this.dataService.updatePharmacyHead(editedHead)
     95            .subscribe((hd: IPharmacyHead) => {
     96              if(hd) {
     97                this.openSnackBar("Success! PharmacyHead edited", "OK").onAction().subscribe(() => {
     98                  window.location.reload();
     99                });
     100              }
     101              else {
     102                this.openSnackBar("PharmacyHead edit failed", "Try again");
     103              }
     104            },
     105            (err: any) => console.log(err),
     106            () => console.log('PharmacyHead data updated'));
    103107      }
    104108    });
     
    123127        .subscribe((status: boolean) => {
    124128          if(status) {
    125             this.openSnackBar("Request processed!","OK");
     129            this.openSnackBar("Request rejected!","OK");
     130          }
     131          else {
     132            this.openSnackBar("Something went wrong","Try again");
    126133          }
    127134        },
    128135        (err: any) => console.log(err),
    129         () => {
    130           console.log("PharmacyHeadRequest deleted");
    131           location.reload();
    132         });
     136        () => console.log("PharmacyHeadRequest deleted"));
    133137  }
    134138
     
    144148        },
    145149        (err: any) => console.log(err),
    146         () => {
    147           console.log("PharmacyHead updated");
    148           location.reload();
    149         })
     150        () => console.log("PharmacyHead updated"))
    150151    }
    151152  }
Note: See TracChangeset for help on using the changeset viewer.