package com.img.rabbit.viewmodel

import androidx.compose.runtime.mutableStateOf
import com.img.rabbit.bean.local.ErrorBean
import com.img.rabbit.provider.api.ApiManager
import okhttp3.RequestBody

class AccountManagerViewModel : BaseViewModel() {
    // 错误状态
    val errorState = mutableStateOf<ErrorBean?>(null)

    fun requestAccount() {
        isLoading.value = true // 开始加载
        mLaunch {
            val response = ApiManager.serviceVo.account()
            if (response.status) {
                // TODO 处理获取账号列表
            }else{
                errorState.value = ErrorBean(response.code.toString(), response.message.ifEmpty { "提交失败..." })
            }
            isLoading.value = false // 开始加载
        }
    }
}