Fixing the builder services

Now that we have WorkoutService set up to retrieve a workout from our remote data store, we have to modify WorkoutBuilderService to be able to retrieve that workout as an Observable. The method that pulls the Workout details is startBuilding. In order to do that, we will break the current startBuilding method into two methods, one for new workouts and one for existing workouts that we have retrieved from the server. Here is the code for new workouts:

    startBuildingNew() {
const exerciseArray: ExercisePlan[] = [];
this.buildingWorkout = new WorkoutPlan('', '', 30, exerciseArray);
this.newWorkout = true;
return this.buildingWorkout;
}

For existing workouts, we add the following code:

    startBuildingExisting(name: string) {
this.newWorkout = false;
return this.workoutService.getWorkout(name);
}

We'll let you make the same fixes in ExerciseBuilderService.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.5.86