mirror of
https://github.com/langgenius/dify.git
synced 2026-02-09 23:20:12 -05:00
fix: fix mcp server status is not right (#31826)
Co-authored-by: Stephen Zhou <38493346+hyoban@users.noreply.github.com>
This commit is contained in:
@@ -103,15 +103,22 @@ const MCPDetailContent: FC<Props> = ({
|
|||||||
return
|
return
|
||||||
if (!detail)
|
if (!detail)
|
||||||
return
|
return
|
||||||
const res = await authorizeMcp({
|
try {
|
||||||
provider_id: detail.id,
|
const res = await authorizeMcp({
|
||||||
})
|
provider_id: detail.id,
|
||||||
if (res.result === 'success')
|
})
|
||||||
handleUpdateTools()
|
if (res.result === 'success')
|
||||||
|
handleUpdateTools()
|
||||||
|
|
||||||
else if (res.authorization_url)
|
else if (res.authorization_url)
|
||||||
openOAuthPopup(res.authorization_url, handleOAuthCallback)
|
openOAuthPopup(res.authorization_url, handleOAuthCallback)
|
||||||
}, [onFirstCreate, isCurrentWorkspaceManager, detail, authorizeMcp, handleUpdateTools, handleOAuthCallback])
|
}
|
||||||
|
catch {
|
||||||
|
// On authorization error, refresh the parent component state
|
||||||
|
// to update the connection status indicator
|
||||||
|
onUpdate()
|
||||||
|
}
|
||||||
|
}, [onFirstCreate, isCurrentWorkspaceManager, detail, authorizeMcp, handleUpdateTools, handleOAuthCallback, onUpdate])
|
||||||
|
|
||||||
const handleUpdate = useCallback(async (data: any) => {
|
const handleUpdate = useCallback(async (data: any) => {
|
||||||
if (!detail)
|
if (!detail)
|
||||||
|
|||||||
Reference in New Issue
Block a user