package com.adit.smartplant.viewmodel import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.adit.smartplant.model.RiwayatItem import com.adit.smartplant.network.RetrofitClient import kotlinx.coroutines.launch class RiwayatViewModel : ViewModel() { var riwayatList by mutableStateOf>(emptyList()) private set fun loadRiwayat(userId: Int) { viewModelScope.launch { try { riwayatList = RetrofitClient.api.getRiwayat(userId) } catch (e: Exception) { e.printStackTrace() } } } }