Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "success":true,
- "data":{"can be some kind of data, array or error message"}
- }
- data class GeneralResponseModel(
- val success: Boolean,
- val data: Any
- )
- //
- val response = gson.fromJson(it[0].toString(), GeneralResponseModel::class.java)
- //
- ////////
- if (res.success) {
- isLoading.postValue(false)
- ///////
- } else {
- val result = res.data as ResponseError
- errorMessage.postValue(ErrorWrapper(ErrorType.REQUEST_ERROR,result.detail,result.title))
- isLoading.postValue(false)
- }
- ///////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement