This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class StoreViewModel @Inject constructor(private val api: ServiceInterface, private val netManager: NetManager): ViewModel() { | |
| val isLoading = ObservableField<Boolean>() | |
| var storeData = MutableLiveData<Store>() | |
| fun fetchStore(storeId: Int, failFunc: (String, String) -> Unit) = launch(UI) { | |
| netManager.isConnectedToInternet?.let { | |
| if(it) { | |
| isLoading.set(true) | |
| api.getStore(storeId).await().handleResponse(failFunc)?.let { storeData.value = it} |