import type { ComputedRef, Ref } from "vue";

export type LoaderLoadType = 'loading' | 'finished' | 'nomore' | 'error' | 'empty';

/**
 * 说明：
 * * 通用加载器接口。
 * @param P 加载参数类型
 */
export interface ILoaderCommon<P> {
  error: Ref<string>;
  status: Ref<LoaderLoadType>;
  isLoaded: ComputedRef<boolean>;
  load: (refresh?: boolean, params?: P) => Promise<void>;
  reload: () => Promise<void>;
}