import { request } from '@vtx/utils';
import { useEffect } from 'react';
import { useState } from 'react';

export const getGasEnum = async className => {
    const res = await request.get(`/cloud/gas/api/v1/common/enumList`, {
        body: {
            className,
        },
    });
    let list = [];
    if (res?.result === 0) {
        list = res.data;
    }
    return list;
};

export default className => {
    const [enumList, setEnumList] = useState([]);
    useEffect(() => {
        getGasEnum(className).then(data => {
            setEnumList(data);
        });
    }, []);
    return {
        enumList,
    };
};
