Skip to content

Commit

Permalink
fix redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
JzoNgKVO committed Jul 3, 2024
1 parent 582edd4 commit eae3621
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web/app/(commonLayout)/datasets/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use client'

// Libraries
import { useRef, useState } from 'react'
import { useEffect, useRef, useState } from 'react'
import { useRouter } from 'next/navigation'
import { useTranslation } from 'react-i18next'
import { useDebounceFn } from 'ahooks'
import useSWR from 'swr'
Expand All @@ -22,9 +23,12 @@ import { fetchDatasetApiBaseUrl } from '@/service/datasets'
// Hooks
import { useTabSearchParams } from '@/hooks/use-tab-searchparams'
import { useStore as useTagStore } from '@/app/components/base/tag-management/store'
import { useAppContext } from '@/context/app-context'

const Container = () => {
const { t } = useTranslation()
const router = useRouter()
const { currentWorkspace } = useAppContext()
const showTagManagementModal = useTagStore(s => s.showTagManagementModal)

const options = [
Expand Down Expand Up @@ -57,6 +61,11 @@ const Container = () => {
handleTagsUpdate()
}

useEffect(() => {
if (currentWorkspace.role === 'normal')
return router.replace('/apps')
}, [currentWorkspace])

return (
<div ref={containerRef} className='grow relative flex flex-col bg-gray-100 overflow-y-auto'>
<div className='sticky top-0 flex justify-between pt-4 px-12 pb-2 leading-[56px] bg-gray-100 z-10 flex-wrap gap-y-2'>
Expand Down

0 comments on commit eae3621

Please sign in to comment.