setActive method

Future<void> setActive({
  1. String? organizationId,
  2. String? organizationSlug,
})

Set an organization as active

organizationId The ID of the organization to set as active organizationSlug The slug of the organization to set as active

Implementation

Future<void> setActive({String? organizationId, String? organizationSlug}) async {
  assert(
    organizationId != null || organizationSlug != null,
    "Either organizationId or organizationSlug must be provided",
  );
  try {
    await dio.post(
      "/organization/set-active",
      data: {
        "organizationId": organizationId,
        "organizationSlug": organizationSlug,
      }..removeWhere((key, value) => value == null),
      options: await getOptions(isTokenRequired: true),
    );
  } catch (e) {
    final message = getErrorMessage(e);
    if (message == null) rethrow;
    throw message;
  }
}