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

const getRoleCode = async () => {
    const data = await request.get('/cloud/gas/api/v1/common/listUserBindRoleCode');
    if (!!data && !data.result) {
        return data?.data || [];
    }
};

export default () => {
    const [roleCode, setRoleCode] = useState([]);
    useEffect(() => {
        getRoleCode().then(data => {
            setRoleCode(data);
        });
    }, []);

    return { roleCode };
};
