import { Form, Spin } from 'antd';
import { memo, useEffect } from 'react';
import CustomCheckboxGroup from '../CustomCheckboxGroup';

const RoleStep = ({ show, roleInitFetch, roleLoading, roleAllData, isHaveDate, roleList }) => {
  useEffect(() => {
    if (show) {
      roleInitFetch();
    }
  }, [show]);
  return (
    <Spin spinning={roleLoading}>
      <Form.Item name="roles">
        <CustomCheckboxGroup options={roleAllData} isHaveDate={isHaveDate} oldData={roleList} />
      </Form.Item>
    </Spin>
  );
};
export default memo(RoleStep);
