<template>
  <SimplePageContentLoader :loader="ichData">
    <SimpleList
      v-if="ichData.status.value !== 'error' && ichData.status.value !== 'loading'"
      :data="ichData.content.value || []"
      @itemClick="(item) => navTo('collect/forms/works', { id: item.id })"
    />
  </SimplePageContentLoader>
</template>

<script setup lang="ts">
import InheritorContent from '@/api/collect/InheritorContent';
import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
import SimpleList from '@/components/list/SimpleList.vue';
import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader.vue';
import { navTo } from '@/components/utils/PageAction';

const ichData = useSimpleDataLoader(async () => {
  const data = await InheritorContent.getIchInfo(undefined);
  return await InheritorContent.getIchWorksInfo({
    ichId: data.id,
    page: 1,
    pageSize: 100,
  });
});
</script>