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

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

/**
 *Created  by .yzq on 2022/3/26/026.
 * @link
 * @description:
 */
class RechargeHistoryViewModel : ViewModel() {
    val mRechargeHistoryListLiveData = MutableLiveData<Result<MutableList<RechargeHistoryBean>>>()

    fun getRechargeHistory(activity: BaseActivity<*>, deviceId: String) {
        activity.showLoading(true)
        viewModelScope.launch {
            val result = NetworkApi.getRechargeHistory(deviceId)
            mRechargeHistoryListLiveData.value = result
        }
    }
}