Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
f8bae897
Unverified
Commit
f8bae897
authored
Jul 26, 2023
by
zxhlyh
Committed by
GitHub
Jul 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: switch workspace (#642)
parent
dd1172b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
index.tsx
...ents/header/account-dropdown/workplace-selector/index.tsx
+1
-3
No files found.
web/app/components/header/account-dropdown/workplace-selector/index.tsx
View file @
f8bae897
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 = `
...
@@ -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 = () => {
...
@@ -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'
)
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment