import 'package:feelverapp/model/favorite/delete_favorite_Model.dart';
import 'package:feelverapp/model/favorite/favorite_Model.dart';
import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/favorite/favorite.dart';
import 'package:flutter/material.dart';

class FavoritePresenter extends BasePresenter<Favorite> {
  Api _api;
  final formkey = GlobalKey<FormState>();
  FavoriteModel favoriteModel;
  DeletefavoriteModel deletefavoriteModel;

  FavoritePresenter(State<Favorite> state) : super(state);

  Favoriteitem() async {
    _api = Api<FavoriteModel>();
    var res = await _api.favorite({
      "customer_id": "224",
    });

    if (res.fail == null) {
      setState(() {
        favoriteModel = res.success;
      });
    } else {
      print('res Fail');
    }
  }

  Deletefavoriteitem() async {
    _api = Api<DeletefavoriteModel>();
    var res = await _api.deletefavorite({
      "id": "146",
    });

    if (res.fail == null) {
      setState(() {
        deletefavoriteModel = res.success;
      });
    } else {
      print('res Fail');
    }
  }



}
