import { getApiLoading } from '@/common/libraries/apiLoading'
import { Apis } from '@/gen/Apis'
import useModel from './model'

const getHouseCollectionRecords = () => {
  getApiLoading(Apis.Collection.HouseCollectionRecords.List, useModel?.formData?.value).then(
    res => {
      useModel.listData.value = [...useModel.listData.value, ...res?.data]
      useModel.metaData.value = res?.meta
    }
  )
}

export default {
  getHouseCollectionRecords,
  loadMore(page: number) {
    useModel.formData.value.page = page
    getHouseCollectionRecords()
  }
}
