mirror of
https://github.com/langgenius/dify.git
synced 2025-08-15 12:47:08 +00:00
fix: page loop in datasets and apps if current user is dataset_operator (#21114)
This commit is contained in:
parent
110bb5e5a5
commit
c5acffb034
@ -8,15 +8,15 @@ import { useRouter } from 'next/navigation'
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
export default function DatasetsLayout({ children }: { children: React.ReactNode }) {
|
export default function DatasetsLayout({ children }: { children: React.ReactNode }) {
|
||||||
const { isCurrentWorkspaceEditor } = useAppContext()
|
const { isCurrentWorkspaceEditor, isCurrentWorkspaceDatasetOperator } = useAppContext()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isCurrentWorkspaceEditor)
|
if (!isCurrentWorkspaceEditor && !isCurrentWorkspaceDatasetOperator)
|
||||||
router.replace('/apps')
|
router.replace('/apps')
|
||||||
}, [isCurrentWorkspaceEditor, router])
|
}, [isCurrentWorkspaceEditor, isCurrentWorkspaceDatasetOperator, router])
|
||||||
|
|
||||||
if (!isCurrentWorkspaceEditor)
|
if (!isCurrentWorkspaceEditor && !isCurrentWorkspaceDatasetOperator)
|
||||||
return <Loading type='app' />
|
return <Loading type='app' />
|
||||||
return (
|
return (
|
||||||
<ExternalKnowledgeApiProvider>
|
<ExternalKnowledgeApiProvider>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user