import { PageListController } from "@queenjs/controllers";
import { ModuleRoot, RequestConfig } from "queenjs";
import actions from "./actions";
import { https } from "./http";
import { ItemObject } from "./objects/item";
import { stores } from "./stores";

export default class ListModule extends ModuleRoot {
  config = this.setConfig({
    httpConfig: {
      baseURL:"./",
    },
  });

  store = this.createStore([stores]);
  actions = this.createActions(actions);
  https = this.createHttps([https]);
  controls = {
    backendList: new PageListController(this.config.httpConfig),
  };
  list: ItemObject[] = [];

  onReady() {
    this.controls.backendList.setCrudPrefix("/antique");
  }
}
export const { useList, initList, setList } = ListModule.hook("List");
