import { Result } from 'antd'
import useAuthStore from '@/stores/Auth'

export default function RequireAuth({ children, ...props }, ) {

  const isPermitted = useAuthStore((state) => state.isPermitted)

  if (isPermitted(props.subject)) {
  // if (props.subject === '/account/management') {
    return children
  } else if (props.result) {
    return (
      <Result
        status='403'
        title='403'
        subTitle={'抱歉，你没有权限使用该功能。'}
      />
    )
  }
}