package com.bjzc.zjdxj.base;


import android.content.Context;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by ruihong on 2022/03/03.
 */

public abstract class BaseCallBackNoProgress<T> implements Callback<T> {

    private Context context;

    public BaseCallBackNoProgress(Context context) {
        this.context = context;
    }

    @Override
    public void onResponse(Call<T> call, Response<T> response) {
        onSuccess(call, response);
    }

    @Override
    public void onFailure(Call<T> call, Throwable t) {
        //Toast.makeText(context, "网络连接失败" , Toast.LENGTH_SHORT).show();
        onError(call, t);
    }

    public abstract void onSuccess(Call<T> call, Response<T> response);

    public abstract void onError(Call<T> call, Throwable t);
}