import { post } from "@/utils/request";
import dict from "@/store/modules/dict";

export const getDict = (dictType: string) => {
  post("/common/dict", { dictType }).then(([err, data]) => {
    if (err) return;
    const v = data.list.map((x: any) => ({
      key: x.dictLabel,
      value: x.dictValue
    })) as IDict[];
    dict.add({ k: dictType, v });
  });
  return [{ key: "请选择", value: "" }] as IDict[];
};
