Changeset 6e6f04b for Farmatiko/ClientApp/src/app/admin/admin.component.ts
- Timestamp:
- 02/11/21 03:50:10 (4 years ago)
- Branches:
- master
- Children:
- f554983
- Parents:
- 8eb1e21 (diff), dae4cde (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Farmatiko/ClientApp/src/app/admin/admin.component.ts
r8eb1e21 r6e6f04b 56 56 createHead() { 57 57 this.dataService.insertPharmacyHead(this.head) 58 .subscribe((cHead: IPharmacyHead) => { 59 if(cHead) { 58 .subscribe((cHead) => { 60 59 this.heads.push(cHead); 61 60 this.openSnackBar("New head created!","OK"); 62 }63 61 }, 64 62 (err: any) => console.log(err), … … 79 77 }, 80 78 (err: any) => console.log(err), 81 () => console.log("PharmacyHead deleted")); 79 () => { 80 console.log("PharmacyHead deleted"); 81 location.reload(); 82 }); 82 83 } 83 84 … … 88 89 }); 89 90 dialogRef.afterClosed().subscribe((editedHead: IPharmacyHead) => { 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')); 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')); 107 103 } 108 104 }); … … 127 123 .subscribe((status: boolean) => { 128 124 if(status) { 129 this.openSnackBar("Request rejected!","OK"); 130 } 131 else { 132 this.openSnackBar("Something went wrong","Try again"); 125 this.openSnackBar("Request processed!","OK"); 133 126 } 134 127 }, 135 128 (err: any) => console.log(err), 136 () => console.log("PharmacyHeadRequest deleted")); 129 () => { 130 console.log("PharmacyHeadRequest deleted"); 131 location.reload(); 132 }); 137 133 } 138 134 … … 148 144 }, 149 145 (err: any) => console.log(err), 150 () => console.log("PharmacyHead updated")) 146 () => { 147 console.log("PharmacyHead updated"); 148 location.reload(); 149 }) 151 150 } 152 151 }
Note:
See TracChangeset
for help on using the changeset viewer.