package com.mayi.fastdevelop.commonpage.login;

import com.mayi.fastdevelop.api.UserAPI;
import com.mayi.fastdevelop.bean.UserInfo;
import com.mayi.fastdevelop.okhttp.ResultCallback;

public class LoginPresenter extends LoginContract.Presenter {

    @Override
    public void login(String mobile, String password) {
        UserAPI.login(mobile, password, new ResultCallback<UserInfo>() {
            @Override
            public void onFail(String msg) {
                if (getView() != null) {
                    getView().loginFailure(msg);
                }
            }

            @Override
            public void onSuccess(UserInfo userInfo) {
                if (getView() != null) {
                    getView().loginSuccess(userInfo);
                }
            }
        });
    }

}
