package com.cooleshow.student.presenter.mine;

import com.cooleshow.base.presenter.BasePresenter;
import com.cooleshow.base.rx.BaseObserver;
import com.cooleshow.base.utils.RequestBodyUtil;
import com.cooleshow.student.api.APIService;
import com.cooleshow.student.contract.ModifyNickNameContract;
import com.cooleshow.usercenter.bean.SetDetailBean;

/**
 * 创建日期：2022/5/16 17:49
 *
 * @author Ryan
 * 类说明：
 */
public class ModifyNickNamePresenter extends BasePresenter<ModifyNickNameContract.ModifyNickNameView> implements ModifyNickNameContract.Presenter {

    public void submitSetDetail(String jsonStr){
        getView().showLoading();
        addSubscribe(create(APIService.class).submitSetDetail(RequestBodyUtil.convertToRequestBodyJson(jsonStr)), new BaseObserver<SetDetailBean>(getView()) {
            @Override
            protected void onSuccess(SetDetailBean data) {
                if (getView() != null) {
                    getView().submitSetDetailSuccess(data);
                }
            }

            @Override
            public void onComplete() {
                super.onComplete();
                getView().hideLoading();
            }
            @Override
            public void onError(Throwable e) {
                super.onError(e);

            }
        });
    }
}