updateProfile method

  1. @override
Future<Either<Failure, Profile>> updateProfile({
  1. required Profile model,
})
override

Implementation

@override
Future<Either<Failure, Profile>> updateProfile(
    {required Profile model}) async {
  try {
    final param = {
      "codeUser": id,
    };
    Map<String, dynamic> body = model.toMap();
    body['customerId'] = id;

    final result = await httpHandler.patch(
      url: Api.profile.updateProfile,
      requestBody: body,
      queryParameters: param,
    );

    return Right(ProfileDto.fromJson(result).jsonResult);
  } on Exception catch (error) {
    return Left(FailureResponse.mapExceptionToFailure(error));
  }
}