结算页面、设置页面
This commit is contained in:
@@ -158,12 +158,14 @@ class UserViewModel : BaseViewModel() {
|
||||
/**
|
||||
* 搜索食物
|
||||
*/
|
||||
fun searchByFoodName(foodName: String) {
|
||||
fun searchByFoodName(foodName: String, action: (List<FoodInfo>) -> Unit = {}) {
|
||||
Timber.d("searchByFoodName foodName = $foodName")
|
||||
launchWithLoading {
|
||||
val response = repository.getRestInfoFoodsByType(foodName = foodName)
|
||||
if (parseResponse(response)) {
|
||||
_searchFoodInfoList.value = response.result ?: emptyList()
|
||||
val list = response.result ?: emptyList()
|
||||
action(list)
|
||||
_searchFoodInfoList.value = list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user