Skip to content

Commit 3f3de74

Browse files
committed
fix: refetch
1 parent 5fe417a commit 3f3de74

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

www/components/frpc_card.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { FRPCEditor } from './frpc_editor'
1111
import { FRPCForm } from './frpc_form'
1212
import { useSearchParams } from 'next/navigation'
1313
import { $clientProxyConfigs } from '@/store/proxy'
14+
import { ClientConfig } from '@/types/client'
1415

1516
export interface FRPCFormCardProps {
1617
clientID?: string
@@ -68,8 +69,20 @@ export const FRPCFormCard: React.FC<FRPCFormCardProps> = ({
6869
setClientID(paramClientID)
6970
setServerID(client?.client?.serverId)
7071
}
71-
$clientProxyConfigs.set([])
72-
}, [paramClientID, client])
72+
73+
if (!client || !client?.client || !client?.client?.config) return
74+
const proxyConfs = (JSON.parse(client?.client?.config) as ClientConfig).proxies
75+
if (proxyConfs) {
76+
$clientProxyConfigs.set(proxyConfs)
77+
}
78+
79+
}, [paramClientID])
80+
81+
useEffect(() => {
82+
if (clientID) {
83+
setServerID(client?.client?.serverId)
84+
}
85+
}, [clientID, paramClientID, client])
7386

7487
return (
7588
<Card className="w-full">

www/components/frpc_form.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export const FRPCForm: React.FC<FRPCFormProps> = ({ clientID, serverID }) => {
8484
clientId: clientID,
8585
})
8686
await refetchClient()
87-
$clientProxyConfigs.set([])
8887
toast({ title: '更新隧道状态', description: res.status?.code === RespCode.SUCCESS ? '更新成功' : '更新失败' })
8988
} catch (error) {
9089
console.error(error)

0 commit comments

Comments
 (0)