newSavedScans method

  1. @override
Future<Either<Failure, MyLogModel>> newSavedScans(
  1. String token,
  2. MyLogModel model
)
override

Implementation

@override
Future<Either<Failure, MyLogModel>> newSavedScans(
    String token, MyLogModel model) async {
  try {
    final headers = {
      'Content-Type': 'application/json',
    };
    dio.options.headers['Authorization'] =
        'Bearer $token'; // replace <your-access-token> with your actual token
    final options = Options(headers: headers);
    var response = await dio.post("$valorUrl/saved-scanns",
        options: options, data: model.toJson());
    if (response.statusCode == 201) {
      return Right(MyLogModel.fromJson(response.data));
    } else {
      return Left(ServiceFailure());
    }
  } catch (e) {
    _sentryUtil.captureException(e);
    return Left(ServiceFailure());
  }
}