package com.cheng.blzb.ui.fragment.mine.order.invoice

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

class InvoiceViewModel: BaseViewModel() {
    val updateLiveData = MutableLiveData<Any>()

    fun updateOrder(requestBody: RequestBody) {
        showDialog()
        launchOnUiTryCatch({
            val response = ApiFactory.apiService.updateOrder(requestBody)
            if (response.status) {
                updateLiveData.postValue(Any())
            } else toast(response.message, true)
            dismissDialog()
        }, {
            dismissDialog()
            setError(it)
            L.d(it)
        })
    }
}