import api from "@/axios";

type DictType =
    'CheckStatus'
    | 'DeleteFlag'
    | 'IsEnable'
    | 'IsOrNot'
    | 'Sex'

export const initEnums = () => {
    api.get<Record<DictType, SelectNodeVo<any>[]>>('/common/enums').then(resp => {
        sessionStorage.setItem('dictMap', JSON.stringify(resp.data))
    })
}

export const dictSelectNodes = <T>(enumType: DictType): SelectNodeVo<T>[] => JSON.parse(sessionStorage.getItem('dictMap') as string)?.[enumType] || []

