mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 22:28:55 +08:00
tweaks
This commit is contained in:
parent
8673d4433b
commit
479b813531
@ -1,24 +1,17 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
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 { redirect } from '@/next/navigation'
|
||||
|
||||
export default function DatasetsLayout({ children }: { children: React.ReactNode }) {
|
||||
const { isCurrentWorkspaceEditor, isCurrentWorkspaceDatasetOperator, currentWorkspace, isLoadingCurrentWorkspace } = useAppContext()
|
||||
const router = useRouter()
|
||||
const isWorkspaceReady = !isLoadingCurrentWorkspace && !!currentWorkspace.id
|
||||
const shouldRedirect = isWorkspaceReady && !(isCurrentWorkspaceEditor || isCurrentWorkspaceDatasetOperator)
|
||||
|
||||
useEffect(() => {
|
||||
if (shouldRedirect)
|
||||
router.replace('/apps')
|
||||
}, [shouldRedirect, router])
|
||||
|
||||
if (shouldRedirect) {
|
||||
return null
|
||||
return redirect('/apps')
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user