Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. {
  2. "success":true,
  3. "data":{"can be some kind of data, array or error message"}
  4. }
  5.  
  6. data class GeneralResponseModel(
  7. val success: Boolean,
  8. val data: Any
  9. )
  10.  
  11. //
  12. val response = gson.fromJson(it[0].toString(), GeneralResponseModel::class.java)
  13. //
  14.  
  15. ////////
  16. if (res.success) {
  17. isLoading.postValue(false)
  18. ///////
  19. } else {
  20. val result = res.data as ResponseError
  21. errorMessage.postValue(ErrorWrapper(ErrorType.REQUEST_ERROR,result.detail,result.title))
  22. isLoading.postValue(false)
  23. }
  24.  
  25. ///////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement