package com.zxbw.modulemain.box.presenter

import com.zxbw.modulemain.box.contract.EditAddressContract
import com.zxhl.cms.net.ApiClient
import com.zxhl.cms.net.RxSchedulers
import com.zxhl.cms.net.callback.BaseObserver
import com.zxhl.cms.net.model.box.AddressEntity

class EditAddressPresenter : EditAddressContract.Presenter {
    private val mView: EditAddressContract.View

    constructor(mView: EditAddressContract.View) {
        this.mView = mView
    }

    override fun editAddress(enity: AddressEntity?) {
        ApiClient.homeApi.editAddress(enity)
            .compose(RxSchedulers.observableIO2Main())
            .subscribe(object : BaseObserver<Any>() {
                override fun onSuccess(result: Any?) {
                    if (result != null) {
                        mView.saveSunccess()
                    }
                }

                override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {

                }
            })
    }

}