Skip to content

Commit 0d74dfb

Browse files
Dan WahlinDan Wahlin
Dan Wahlin
authored and
Dan Wahlin
committed
Simplified code
1 parent 2e2e06a commit 0d74dfb

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/public/app/customers/customer-edit-reactive.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ export class CustomerEditReactiveComponent implements OnInit {
4747
getCustomer(id: string) {
4848
this.dataService.getCustomer(id)
4949
.subscribe((customer: ICustomer) => {
50-
//Quick and dirty clone used in case user cancels out of form
51-
const cust = JSON.stringify(customer);
52-
this.customer = JSON.parse(cust);
50+
this.customer = customer;
5351
this.buildForm();
5452
},
5553
(err) => console.log(err));

src/public/app/customers/customer-edit.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ export class CustomerEditComponent implements OnInit {
4242
getCustomer(id: string) {
4343
this.dataService.getCustomer(id)
4444
.subscribe((customer: ICustomer) => {
45-
//Quick and dirty clone used in case user cancels out of form
46-
const cust = JSON.stringify(customer);
47-
this.customer = JSON.parse(cust);
45+
this.customer = customer;
4846
},
4947
(err: any) => console.log(err));
5048
}

0 commit comments

Comments
 (0)