package com.cooleshow.base.presenter;

import com.cooleshow.base.bean.AddressBean;
import com.cooleshow.base.constanst.AddressListContract;
import com.cooleshow.base.constanst.ScanContract;
import com.cooleshow.base.data.api.UploadApi;
import com.cooleshow.base.data.net.ApiException;
import com.cooleshow.base.rx.BaseObserver;
import com.cooleshow.base.utils.ErrorParse;
import com.cooleshow.base.utils.ToastUtil;

import java.util.List;


/**
 * 创建日期：2022/5/17 15:23
 *
 * @author Ryan
 * 类说明：
 */
public class ScanPresenter extends BasePresenter<ScanContract.ScanView> implements ScanContract.Presenter {
    /**
     * 二维码扫描登录
     *
     * @param code
     */
    public void doQrLogin(String code) {
        getView().showLoading();
        addSubscribe(create(UploadApi.class).doQrLogin(code), new BaseObserver<Object>(getView()) {
            @Override
            protected void onSuccess(Object data) {
                if (getView() != null) {
//                    getView().delAddress();
                }
            }

            @Override
            public void onComplete() {
                super.onComplete();
                if (getView() != null) {
                    getView().hideLoading();
                }
            }
        });
    }
}
