mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 06:35:55 +08:00
replace searchParams after redirection
This commit is contained in:
parent
9adda90227
commit
18eb5ad33f
@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
|
||||
import NewMCPCard from './create-card'
|
||||
import MCPCard from './provider-card'
|
||||
import MCPDetailPanel from './detail/provider-detail'
|
||||
@ -39,6 +39,8 @@ function renderDefaultCard() {
|
||||
const MCPList = ({
|
||||
searchText,
|
||||
}: Props) => {
|
||||
const router = useRouter()
|
||||
const pathname = usePathname()
|
||||
const searchParams = useSearchParams()
|
||||
const authCode = searchParams.get('code') || ''
|
||||
const providerID = searchParams.get('state') || ''
|
||||
@ -78,6 +80,7 @@ const MCPList = ({
|
||||
|
||||
const handleUpdateAuthorization = async (providerID: string, code: string) => {
|
||||
const targetProvider = list.find(provider => provider.id === providerID)
|
||||
router.replace(pathname)
|
||||
if (!targetProvider) return
|
||||
await updateMCPAuthorizationToken({
|
||||
provider_id: providerID,
|
||||
|
Loading…
x
Reference in New Issue
Block a user