package com.bc_chat.account.presenter

import com.bc_chat.account.contract.ForPwdContract
import com.bc_chat.account.task.ResetTask
import com.google.gson.JsonObject
import com.zhaohaoting.framework.abs.presenter.BasePresenter
import com.zhaohaoting.framework.requset.NetWorkCallBack
import java.lang.Exception

/**
 * author：Created by zhaohaoting on 2019/3/5
 * email：526309416@qq.com
 * desc：忘记密码
 */
class ForgetPresenter constructor(view: ForPwdContract.View) : BasePresenter<ForPwdContract.View>(view), ForPwdContract.Presenter {
    override fun regetPwd(phone: String?, password: String?) {
        taskHelper.execute<Any>(ResetTask(phone, password), object : NetWorkCallBack<JsonObject>() {
            override fun onPreExecute(task: Any?) {
                super.onPreExecute(task)
                view.showLoading(task)
            }

            override fun onPostExecuteSuccess(task: Any?, data: JsonObject?) {
                view.forPadSuccess()
                view.dismissLoading(task)
            }

            override fun onPostExecuteFailure(task: Any?, exception: Exception?) {
                super.onPostExecuteFailure(task, exception)
                view.forPadFailure(exception)
                view.dismissLoading(task)
            }
        })
    }

}