updateUserProfile method

Future<bool> updateUserProfile(
  1. UpdateUserProfileRequest userProfileModel
)

Implementation

Future<bool> updateUserProfile(
    UpdateUserProfileRequest userProfileModel) async {
  String addUserGql = """
            mutation updateUserProfile(\$id: String, \$userInput: UserInput!) {
              updateUserProfile(id: \$id, userInput: \$userInput) {
                _id
                contactName
                companyName
                mobileNumber
                emailId
                altMobileNumber
                gstNumber
                firstName
                lastName
                altIsdCode
              }
            }
            """;
  GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration();
  GraphQLClient _client = graphQLConfiguration.clientToQuery();
  final vble = {
    "userInput": userProfileModel.userInput,
    "id": userProfileModel.id
  };
  QueryResult result = await _client.mutate(
    MutationOptions(
      document: gql(addUserGql),
      variables: vble,
    ),
  );
  if (!result.hasException) {
    var addAddress = result.data!['updateUserProfile'];
    if (addAddress != null && addAddress["_id"] != null) {
      return true;
    } else {
      return true;
    }
  }
  return false;
}