package com.cooleshow.student.presenter.mine;

import com.cooleshow.base.presenter.BasePresenter;
import com.cooleshow.base.rx.BaseObserver;
import com.cooleshow.student.api.APIService;
import com.cooleshow.student.bean.StudentUserInfo;
import com.cooleshow.student.contract.CheckTeachableContract;

/**
 * 创建日期：2022/6/5 20:17
 *
 * @author Ryan
 * 类说明：
 */
public class CheckTeachablePresenter extends BasePresenter<CheckTeachableContract.CheckTeachableView> implements CheckTeachableContract.Presenter {
    public void queryUserInfo() {
        if (getView() != null) {
            getView().showLoading();
        }
        addSubscribe(create(APIService.class).queryUserInfo(), new BaseObserver<StudentUserInfo>(getView()) {
            @Override
            protected void onSuccess(StudentUserInfo data) {
                if (getView() != null) {
                    getView().queryUserInfoSuccess(data);
                }
            }

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

            @Override
            public void onError(Throwable e) {
                super.onError(e);
                if (getView() != null) {
                    getView().queryUserInfoError();
                }
            }
        });
    }

}