selectCauses method

Future<void> selectCauses(
  1. List<ListCause> selectedCauses
)

Set user's selected causes

Input causes that the user has selected Posts the ids of these causes to the API

Implementation

Future<void> selectCauses(List<ListCause> selectedCauses) async {
  List<int> ids = selectedCauses.map((cause) => cause.id).toList();
  // TODO check this is the correct endpoint
  await _apiService.postRequest('v2/me/causes', body: {'cause_ids': ids});

  // Update user after request
  await locator<AuthenticationService>().fetchUser();
}