Fix creation and update.
This commit is contained in:
parent
e927736b45
commit
3326dac51a
@ -17,6 +17,7 @@ export class ScheduleController{
|
|||||||
private $stateParams,
|
private $stateParams,
|
||||||
private toastrService: ToastrService,
|
private toastrService: ToastrService,
|
||||||
private scheduleService: ScheduleService,
|
private scheduleService: ScheduleService,
|
||||||
|
private logger: Logger,
|
||||||
private $modal
|
private $modal
|
||||||
) {
|
) {
|
||||||
// Load operations on controller initialization.
|
// Load operations on controller initialization.
|
||||||
@ -51,9 +52,11 @@ export class ScheduleController{
|
|||||||
let subscription: Observable<Schedule>;
|
let subscription: Observable<Schedule>;
|
||||||
|
|
||||||
if(operation.id) {
|
if(operation.id) {
|
||||||
subscription = this.scheduleService.create(operation);
|
this.logger.log("updating schedule", operation);
|
||||||
} else {
|
|
||||||
subscription = this.scheduleService.update(operation);
|
subscription = this.scheduleService.update(operation);
|
||||||
|
} else {
|
||||||
|
this.logger.log("creating schedule", operation);
|
||||||
|
subscription = this.scheduleService.create(operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return subscription.subscribe((operation: Schedule) => {
|
return subscription.subscribe((operation: Schedule) => {
|
||||||
|
@ -44,6 +44,6 @@ export class ScheduleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete(schedule: Schedule): Observable<Schedule> {
|
delete(schedule: Schedule): Observable<Schedule> {
|
||||||
return this.one(schedule.id).delete();
|
return this.one(schedule.id).remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user