package com.xw.common.net import com.xw.common.net.interceptor.ApiException import com.xw.common.net.interceptor.HttpResponse import retrofit2.Call import retrofit2.await suspend fun Call>.interceptAwait(): T? { val resp = this@interceptAwait.await() if (resp.code == 200) { return resp.data } else { throw ApiException(resp.code, resp.msg ?: "") } } suspend fun Call>.interceptAwaitRawData(): HttpResponse { val resp = this@interceptAwaitRawData.await() if (resp.code == 200) { return resp } else { throw ApiException(resp.code, resp.msg ?: "") } }