package com.abbidot.tracker.deprecated.ui.fragment.vm

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.abbidot.tracker.base.BaseFragment
import com.abbidot.tracker.bean.PetBean
import com.abbidot.tracker.retrofit2.NetworkApi
import kotlinx.coroutines.launch

/**
 *Created  by .yzq on 2022/3/7/007.
 * @link
 * @description:
 */
class MyPetsViewModel : ViewModel() {
    val mMyPetsListLiveData = MutableLiveData<Result<MutableList<PetBean>>>()

    fun getPetList(fragment: BaseFragment<*>, userId: String, type: Int) {
        fragment.showLoading(true)
        viewModelScope.launch {
            val result = NetworkApi.getPetList(userId, type)
            mMyPetsListLiveData.value = result
        }
    }
}