import { ref, toRefs } from "vue";
import { getDirectory } from "@/api/admin";

export function useDict(...ids: string[]) {
  const dictList: any = ref({});
  return (() => {
    ids.forEach((id: string) => {
      dictList.value[id] = [];
      getDirectory(id).then((res: any) => {
        if (res.code === 0) {
          dictList.value[id] = res.data;
        }
      });
    });
    return toRefs(dictList.value);
  })();
}
