|
|
|
@ -4,7 +4,7 @@ import useAuthStore from '@/stores/Auth'
|
|
|
|
|
|
|
|
|
|
export default function RequireAuth({ children, ...props }) {
|
|
|
|
|
|
|
|
|
|
const isPermitted = useAuthStore((state) => state.isPermitted)
|
|
|
|
|
const [isPermitted, currentUser] = useAuthStore(state => [state.isPermitted, state.currentUser])
|
|
|
|
|
const { userId } = usingStorage()
|
|
|
|
|
|
|
|
|
|
if (isPermitted(props.subject)) {
|
|
|
|
@ -15,7 +15,7 @@ export default function RequireAuth({ children, ...props }) {
|
|
|
|
|
<Result
|
|
|
|
|
status='403'
|
|
|
|
|
title='403'
|
|
|
|
|
subTitle={`抱歉,你(${userId})没有权限使用该功能。`}
|
|
|
|
|
subTitle={`抱歉,你(${currentUser.username})没有权限使用该功能(${props.subject})。`}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|