mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-18 01:55:53 +08:00
fix: switch workspace (#642)
This commit is contained in:
parent
dd1172b57e
commit
f8bae897e5
@ -1,7 +1,6 @@
|
|||||||
import { Fragment } from 'react'
|
import { Fragment } from 'react'
|
||||||
import { useContext } from 'use-context-selector'
|
import { useContext } from 'use-context-selector'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useRouter } from 'next/navigation'
|
|
||||||
import { Menu, Transition } from '@headlessui/react'
|
import { Menu, Transition } from '@headlessui/react'
|
||||||
import cn from 'classnames'
|
import cn from 'classnames'
|
||||||
import s from './index.module.css'
|
import s from './index.module.css'
|
||||||
@ -26,7 +25,6 @@ const itemCheckClassName = `
|
|||||||
|
|
||||||
const WorkplaceSelector = () => {
|
const WorkplaceSelector = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const router = useRouter()
|
|
||||||
const { notify } = useContext(ToastContext)
|
const { notify } = useContext(ToastContext)
|
||||||
const { workspaces } = useWorkspacesContext()
|
const { workspaces } = useWorkspacesContext()
|
||||||
const currentWrokspace = workspaces.filter(item => item.current)?.[0]
|
const currentWrokspace = workspaces.filter(item => item.current)?.[0]
|
||||||
@ -35,7 +33,7 @@ const WorkplaceSelector = () => {
|
|||||||
try {
|
try {
|
||||||
await switchWorkspace({ url: '/workspaces/switch', body: { tenant_id } })
|
await switchWorkspace({ url: '/workspaces/switch', body: { tenant_id } })
|
||||||
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
||||||
router.replace('/apps')
|
location.assign(`${location.origin}`)
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
notify({ type: 'error', message: t('common.provider.saveFailed') })
|
notify({ type: 'error', message: t('common.provider.saveFailed') })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user