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

import androidx.lifecycle.MutableLiveData
import com.cheng.bole.bean.CompanyEntity
import com.cheng.bole.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)
        })
    }
}