updateShippingAddress method
Implementation
Future<bool> updateShippingAddress(
UpdateShippingAddressRequestModel userAddressModel) async {
String addUserGql =
"""mutation updateShippingAddress(\$id: String, \$addressId: String, \$enable: Boolean) {
updateShippingAddress(id: \$id, addressId: \$addressId, enable: \$enable) {
_id
__typename
}
}""";
GraphQLConfiguration graphQLConfiguration = GraphQLConfiguration();
GraphQLClient _client = graphQLConfiguration.clientToQuery();
final vble = {
"addressId": userAddressModel.addressId,
"enable": userAddressModel.enable,
"id": userAddressModel.sId
};
QueryResult result = await _client.mutate(
MutationOptions(
document: gql(addUserGql),
variables: vble,
),
);
if (!result.hasException) {
var updateShippingAddress = result.data!['updateShippingAddress'];
if (updateShippingAddress != null &&
updateShippingAddress["_id"] != null) {
return true;
} else {
return true;
}
}
return false;
}