package com.develop.foodcooking

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.scopeNetLife
import com.develop.common.data_repo.net.Api
import com.develop.common.data_repo.net.model.request.LoginBody.genLoginBody
import com.develop.common.data_repo.net.model.response.LoginResult
import com.develop.base.mvvm.BaseViewModel
import com.drake.net.Post

class MainViewModel : BaseViewModel() {

    var loginResult: MutableLiveData<LoginResult> = MutableLiveData()
    fun login(account: String, password: String) = scopeNetLife {
        loginResult.value = Post<LoginResult>(Api.LOGIN) {
            body = genLoginBody(account, password)
        }.await()

    }

}

