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
05ce7b9d
Unverified
Commit
05ce7b9d
authored
Mar 04, 2024
by
Yeuoly
Committed by
GitHub
Mar 04, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: deep copy customColletion (#2673)
parent
72ddedfc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
index.tsx
...p/components/tools/edit-custom-collection-modal/index.tsx
+10
-9
No files found.
web/app/components/tools/edit-custom-collection-modal/index.tsx
View file @
05ce7b9d
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
import
type
{
FC
}
from
'react'
import
type
{
FC
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
{
useTranslation
}
from
'react-i18next'
import
{
useTranslation
}
from
'react-i18next'
import
produce
from
'immer'
import
{
useDebounce
,
useGetState
}
from
'ahooks'
import
{
useDebounce
,
useGetState
}
from
'ahooks'
import
{
clone
}
from
'lodash-es'
import
cn
from
'classnames'
import
cn
from
'classnames'
import
produce
from
'immer'
import
{
LinkExternal02
,
Settings01
}
from
'../../base/icons/src/vender/line/general'
import
{
LinkExternal02
,
Settings01
}
from
'../../base/icons/src/vender/line/general'
import
type
{
Credential
,
CustomCollectionBackend
,
CustomParamSchema
,
Emoji
}
from
'../types'
import
type
{
Credential
,
CustomCollectionBackend
,
CustomParamSchema
,
Emoji
}
from
'../types'
import
{
AuthHeaderPrefix
,
AuthType
}
from
'../types'
import
{
AuthHeaderPrefix
,
AuthType
}
from
'../types'
...
@@ -116,14 +115,16 @@ const EditCustomCollectionModal: FC<Props> = ({
...
@@ -116,14 +115,16 @@ const EditCustomCollectionModal: FC<Props> = ({
const
[
isShowTestApi
,
setIsShowTestApi
]
=
useState
(
false
)
const
[
isShowTestApi
,
setIsShowTestApi
]
=
useState
(
false
)
const
handleSave
=
()
=>
{
const
handleSave
=
()
=>
{
const
postData
=
clone
(
customCollection
)
// const postData = clone(customCollection)
delete
postData
.
tools
const
postData
=
produce
(
customCollection
,
(
draft
)
=>
{
delete
draft
.
tools
if
(
postData
.
credentials
.
auth_type
===
AuthType
.
none
)
{
if
(
draft
.
credentials
.
auth_type
===
AuthType
.
none
)
{
delete
postData
.
credentials
.
api_key_header
delete
draft
.
credentials
.
api_key_header
delete
postData
.
credentials
.
api_key_header_prefix
delete
draft
.
credentials
.
api_key_header_prefix
delete
postData
.
credentials
.
api_key_value
delete
draft
.
credentials
.
api_key_value
}
}
})
if
(
isAdd
)
{
if
(
isAdd
)
{
onAdd
?.(
postData
)
onAdd
?.(
postData
)
...
...
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