mirror of
https://github.com/langgenius/dify.git
synced 2025-08-15 12:47:08 +00:00
fix: redirect to apps page if current user has no permission to visit dataset page (#21065)
This commit is contained in:
parent
809a0ab6bf
commit
41cb39eb5d
@ -1,9 +1,23 @@
|
||||
'use client'
|
||||
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { ExternalApiPanelProvider } from '@/context/external-api-panel-context'
|
||||
import { ExternalKnowledgeApiProvider } from '@/context/external-knowledge-api-context'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export default function DatasetsLayout({ children }: { children: React.ReactNode }) {
|
||||
const { isCurrentWorkspaceEditor } = useAppContext()
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (!isCurrentWorkspaceEditor)
|
||||
router.replace('/apps')
|
||||
}, [isCurrentWorkspaceEditor, router])
|
||||
|
||||
if (!isCurrentWorkspaceEditor)
|
||||
return <Loading type='app' />
|
||||
return (
|
||||
<ExternalKnowledgeApiProvider>
|
||||
<ExternalApiPanelProvider>
|
||||
|
Loading…
x
Reference in New Issue
Block a user