updatePlan method

  1. @override
Future<void> updatePlan(
  1. String token,
  2. CalendarPlan plan
)
override

Updates the plan for the user associated with the given token and returns the updated plan confirmed by the server.

Implementation

@override
Future<void> updatePlan(String token, CalendarPlan plan) async {
  log('Updating plan');

  try {
    await _apiService.callFunction(
      function: 'local_lbplanner_plan_update_plan',
      token: token,
      body: {
        'planname': plan.name,
        'enableek': plan.optionalTasksEnabled,
      },
    );

    log('Plan updated');
  } catch (e, s) {
    log('Failed to update plan', e, s);
    rethrow;
  }
}