package com.abbidot.tracker.vm

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

/**
 *Created  by .yzq on 2022/2/15/015.
 * @link
 * @description:
 */
class LoginViewModel:ViewModel() {

    val mLoginLiveData=MutableLiveData<Result<UserBean>>()

    fun login(activity: BaseActivity<*>, email: String, password: String){
        activity.showLoading(true)
        viewModelScope.launch {
            val result=NetworkApi.login(email, password)
            mLoginLiveData.value=result
        }
    }
}