package com.swago.home.search

import android.app.Application
import android.widget.Toast
import androidx.lifecycle.MutableLiveData
import com.swago.baseswago.inter.ApiManager
import com.swago.baseswago.model.MomentModel
import com.swago.baseswago.model.home.HomeModel
import com.swago.baseswago.util.AppContext
import com.swago.baseswago.util.BaseViewModel

/**
 *@date 2021/12/2 11:34
 *description:
 */
class SearchVm (application: Application) : BaseViewModel(application) {

    val searchResultLiveData by lazy {
        MutableLiveData<List<MomentModel>?>()
    }


    fun searchUser(name:String,page:Int){
        requestData2 {
            requestData {
                val data = ApiManager.homeApi.searchForUser(name,page)
                searchResultLiveData.value = data.list
            }

            requestError {
                searchResultLiveData.value = null
            }
        }
    }

}