import { observable, runInAction } from "mobx";
import { getAllBookApi, getBookPlatInfoAllApi } from "../API/global";
/**
 * 全局需要的搜索条件列表
 * */
const weComTaskStore: {
  data: {
    // 书
    bookList: TASK_CREATE.BookListProps[];
    // 书城
    bookPlatForm: TASK_CREATE.BookPlatFormProps[];
  };
  /**初始化操作*/
  init(): Promise<void>;
} = {
  data: {
    bookList: [],
    bookPlatForm: []
  },
  /**初始化操作*/
  async init() {
    const bookPlatForm = await getBookPlatInfoAllApi();
    const book = await getAllBookApi();
    runInAction(() => {
      this.data = {
        ...this.data,
        bookList: book?.data || [],
        bookPlatForm: bookPlatForm?.data || [],
      };
    });
  },
  
};
export default observable(weComTaskStore);
