fix: auto authorizing

This commit is contained in:
jZonG 2025-05-29 17:22:19 +08:00
parent 953746bf7e
commit 049f904af8

View File

@ -68,14 +68,19 @@ const MCPList = ({
const handleCreate = async (provider: ToolWithProvider) => {
await refetch() // update list
setCurrentProviderID(provider.id)
await authorizeMcp({
const res = await authorizeMcp({
provider_id: provider.id,
})
if (res.result === 'success') {
await refetch() // update authorization in list
await updateTools(provider.id)
invalidateMCPTools(provider.id)
await refetch() // update tool list in provider list
}
else if (res.authorization_url) {
router.push(res.authorization_url)
}
}
const handleUpdateAuthorization = async (providerID: string, code: string) => {
const targetProvider = list.find(provider => provider.id === providerID)