import 'package:dio/dio.dart';
import '../utils/Request.dart';
import 'package:fluttertoast/fluttertoast.dart';

/// 农机列表
/// @param {*} data
/// @returns
Future getMachineryList(params) async {
  return request('/machinery',
          options: Options(method: 'GET'), queryParameters: params)
      .catchError((error) =>
          {Fluttertoast.showToast(msg: error.error.toString()), print(error)});
}

/// 农机详情
/// @param {*} data
/// @returns
Future getMachineryDetail(String id, params) async {
  return request('/machinery-summary/$id',
          options: Options(method: 'GET'), queryParameters: params)
      .catchError((error) => {
            Fluttertoast.showToast(msg: error.error['message']),
          });
}
