- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/ClientApp/src/app/admin/admin.component.ts
rdae4cde re0cdea2 56 56 createHead() { 57 57 this.dataService.insertPharmacyHead(this.head) 58 .subscribe((cHead) => { 58 .subscribe((cHead: IPharmacyHead) => { 59 if(cHead) { 59 60 this.heads.push(cHead); 60 61 this.openSnackBar("New head created!","OK"); 62 } 61 63 }, 62 64 (err: any) => console.log(err), … … 77 79 }, 78 80 (err: any) => console.log(err), 79 () => { 80 console.log("PharmacyHead deleted"); 81 location.reload(); 82 }); 81 () => console.log("PharmacyHead deleted")); 83 82 } 84 83 … … 89 88 }); 90 89 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')); 103 107 } 104 108 }); … … 123 127 .subscribe((status: boolean) => { 124 128 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"); 126 133 } 127 134 }, 128 135 (err: any) => console.log(err), 129 () => { 130 console.log("PharmacyHeadRequest deleted"); 131 location.reload(); 132 }); 136 () => console.log("PharmacyHeadRequest deleted")); 133 137 } 134 138 … … 144 148 }, 145 149 (err: any) => console.log(err), 146 () => { 147 console.log("PharmacyHead updated"); 148 location.reload(); 149 }) 150 () => console.log("PharmacyHead updated")) 150 151 } 151 152 }
Note:
See TracChangeset
for help on using the changeset viewer.