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