package com.cooleshow.student.presenter.main;

import com.cooleshow.base.presenter.BasePresenter;
import com.cooleshow.base.rx.BaseObserver;
import com.cooleshow.student.api.APIService;
import com.cooleshow.student.contract.MainContract;
import com.cooleshow.usercenter.bean.UserInfo;


/**
 * 创建日期：2022/5/26 9:54
 *
 * @author Ryan
 * 类说明：
 */
public class MainPresenter extends BasePresenter<MainContract.MainView> implements MainContract.Presenter {
    /**
     * 查询UserInfo
     *
     * @param
     */
    @Override
    public void getUserInfo() {
        addSubscribe(create(APIService.class).getUserInfo(), new BaseObserver<UserInfo>(getView()) {
            @Override
            protected void onSuccess(UserInfo data) {
                if (getView() != null) {
                    getView().getUserInfoSuccess(data);
                }
            }
        });
    }
}
