setUserPassword method

Future<SuccessResponse> setUserPassword({
  1. required String userId,
  2. required String newPassword,
})

Set the password of a user

userId The ID of the user to set the password for newPassword The new password to set for the user

Implementation

Future<SuccessResponse> setUserPassword({
  required String userId,
  required String newPassword,
}) async {
  try {
    final response = await super.dio.post(
      "/admin/set-user-password",
      data: {"userId": userId, "newPassword": newPassword},
      options: await super.getOptions(isTokenRequired: true),
    );
    return SuccessResponse.fromJson(response.data);
  } catch (e) {
    final message = getErrorMessage(e);
    if (message == null) rethrow;
    throw message;
  }
}