import { Apis } from '@/gen/Apis'
import useModel from './model'
import { useWeAppAuthStore } from '@/common'
import { getApiLoading } from '@/common/libraries/apiLoading'
import userLoginStatus from '@/common/libraries/userUserLogin'
import { showToastBack, showToast } from '@/common/libraries/naviHelper'
const auth = useWeAppAuthStore()

const getList = () => {
  getApiLoading(Apis.Activity.ActivityEnrolls.List, useModel?.formData?.value).then(res => {
    useModel.listData.value = [...useModel.listData.value, ...res.data]
    useModel.metaData.value = res.meta
    console.log(res)
  })
}

export default {
  getList,
  loadMore(page: number) {
    useModel.formData.value.page = page
    this.getList()
  },
  handleTabsChange(idx: number, res: any) {
    useModel.currentTabs.value = idx
    useModel.formData.value = {
      page: 1,
      status: res?.value
    }
    useModel.listData.value = []
    getList()
    console.log(idx, 'e')
  }
}
