//
//  YHHomePageViewModel.swift
//  galaxy
//
//  Created by davidhuangA on 2024/1/4.
//  Copyright © 2024 www.davidhuang.com. All rights reserved.
//

import UIKit
import RxSwift

class YHHomePageViewModel {
    //数据源
    var configModel:YHHomeCofigMode?
    
    let subject = PublishSubject<YHHomeCofigMode>()
}

//接口
extension YHHomePageViewModel {
    //请求首页的配置
    func getHomeConfig() {
        let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Common.homeConfigApi
        let _ = YHNetRequest.getRequest(url: strUrl) { json, code in
            //1. json字符串 转 对象
            guard let model = NetBaseModel.deserialize(dict: json) else {
                print("error....底层解析出错了...")
                return
            }
            self.subject.onNext(YHHomeCofigMode())
            print("model 是 ==>",model)
        } failBlock: { err in
            print(err)
        }
    }
}
