Unverified Commit f8bae897 authored by zxhlyh's avatar zxhlyh Committed by GitHub

fix: switch workspace (#642)

parent dd1172b5
import { Fragment } from 'react'
import { useContext } from 'use-context-selector'
import { useTranslation } from 'react-i18next'
import { useRouter } from 'next/navigation'
import { Menu, Transition } from '@headlessui/react'
import cn from 'classnames'
import s from './index.module.css'
......@@ -26,7 +25,6 @@ const itemCheckClassName = `
const WorkplaceSelector = () => {
const { t } = useTranslation()
const router = useRouter()
const { notify } = useContext(ToastContext)
const { workspaces } = useWorkspacesContext()
const currentWrokspace = workspaces.filter(item => item.current)?.[0]
......@@ -35,7 +33,7 @@ const WorkplaceSelector = () => {
try {
await switchWorkspace({ url: '/workspaces/switch', body: { tenant_id } })
notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
router.replace('/apps')
location.assign(`${location.origin}`)
}
catch (e) {
notify({ type: 'error', message: t('common.provider.saveFailed') })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment