import React,{useMemo} from 'react';
import './index.less';
import { BaseStore } from '@zenview/micro-basic-library';
function AuthComponent({ actionName, noAuthContent, children }) {
  //TODO 暂时为处理权限
  let action = useMemo(() => BaseStore.auth.isAuth(actionName), [actionName]); //获取按钮权限
  if (!action) {
    return noAuthContent ? noAuthContent : null;
  } else {
    return React.cloneElement(children);
  }
}

export default AuthComponent;
