package com.cheng.blzb.ui.fragment.bid.publish.my

import androidx.lifecycle.MutableLiveData
import com.cheng.blzb.bean.CompanyEntity
import com.cheng.blzb.net.ApiFactory
import com.example.base.extensions.toast
import com.example.base.utils.L
import com.example.base.viewmodel.BaseViewModel

class MyPublishViewModel: BaseViewModel() {
    val companyLiveData = MutableLiveData<CompanyEntity>()

    fun getCompanyInfo() {
        showDialog()
        launchOnUiTryCatch({
            val response = ApiFactory.apiService.getCompanyInfo()
            if (response.status) {
                companyLiveData.postValue(response.data)
            } else toast(response.message, true)
            dismissDialog()
        }, {
            dismissDialog()
            setError(it)
            L.d(it)
        })
    }
}