import { Button, ButtonProps } from 'antd'
import { useAppSelector } from '../store/hooks'

interface PermButtonProps extends ButtonProps {
  permission: string
}

export function PermButton({ permission: _permission, children, ...props }: PermButtonProps) {
  const userType = useAppSelector(s => s.auth.userInfo?.userType)
  if (userType !== '超级管理员') return null
  return <Button {...props}>{children}</Button>
}
