divyanshunegi
07/06/2021, 10:21 AM@InternalSerializationApi
suspend inline fun <reified T, reified K> GETRequest(
path: String,
success: (main: T) -> Unit,
error: (error: K) -> Unit,
noinline genericError: (error: Throwable) -> Unit
) {
try {
val data = httpApiClient.get(baseUrl + path) as T
success.invoke(data)
} catch (ex: Exception) {
handleException(ex, genericError)
}
}