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